magento

warning: file_get_contents(http://www.panticz.de/sites/default/files/magento/order/delete.magento.test.order.sql.txt) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /web/1/000/027/003/273448/htdocs/includes/common.inc(1695) : eval()'d code on line 16.

Magento Cron

cat < /etc/cron.d/magento_cron
MAILTO=YOUR@EMAIL.COM

*/5 * * * * root /var/www/cron.sh
EOF

chmod u+x /var/www/cron.sh

Links
http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job

Magento: Delete unused product images

#!/bin/bash

LOG=/var/log/magento/del_unused_img.log

. /etc/magento/magento.conf

function search_db() {
    COUNT=$(mysql -u ${DB_USER} -p${DB_PASS} ${DB_NAME} --execute="SELECT count(*) FROM catalog_product_entity_media_gallery WHERE value = \"$1\"")

    echo $(echo ${COUNT} | cut -d" " -f2)
}

echo $(date) | tee -a ${LOG}

for IMG in $(find /var/www/media/catalog/product/ -name '*.jpg' ! -path '*cache*' ! -name 'google*'); do
    # search in db
    if [ $(search_db ${IMG/'/var/www/media/catalog/product'/}) != 1 ]; then
        IMG=${IMG##*/}
        for CACHE_IMG in $(find /var/www/media/catalog/product/ -name "${IMG}"); do
            echo "${CACHE_IMG}" | tee -a ${LOG}
            
            rm "${CACHE_IMG}"
        done

        echo "" | tee -a ${LOG}
    fi
done

Links
http://www.magentocommerce.com/magento-connect/defcon2/extension/1147/image-clean/reviews#review_6087
http://stackoverflow.com/questions/4339699/delete-unused-product-images-in-magento

Magento Shadowbox (Rewrite EasyLightBox to Shadowbox)

# install easy light box
http://www.magentocommerce.com/magento-connect/TemplatesMaster/extension/1487/magento-easy-lightbox

# xml
edit
./app/design/frontend/default/default/layout/easylightbox.xml
replace
easylightbox
to
shadowbox

# phtml
copy
./app/design/frontend/default/default/template/easylightbox/media.phtml
to
./app/design/frontend/default/default/template/shadowbox/media.phtml
edit or download
http://www.panticz.de/sites/default/files/magento/shadowbox/media.phtml

# js
copy
./custom/shadowbox/shadowbox.js
to

Fix Magento order tax view

mkdir -p ./app/design/frontend/default/default/template/tax/order
cp ./app/design/frontend/base/default/template/tax/order/tax.phtml ./app/design/frontend/default/default/template/tax/order

--- ./app/design/frontend/base/default/template/tax/order/tax.phtml	2011-06-22 16:08:45.000000000 +0200
+++ ./app/design/frontend/default/default/template/tax/order/tax.phtml	2011-06-22 16:07:28.000000000 +0200
@@ -46,9 +46,9 @@
         <tr class="tax-details-<?php echo $taxIter; ?> tax-details<?php if ($isTop): echo ' tax-details-first'; endif; ?>"<?php if (!$this->getIsPlaneMode()):?> style="display:none;"<?php endif;?>>
             <td <?php echo $this->getLabelProperties()?>>
                 <?php echo $rate['title']; ?>
-                <?php if ($rate['percent']): ?>
+                <!-- <?php if ($rate['percent']): ?>
                     (<?php echo $rate['percent']; ?>%)
-                <?php endif; ?>
+                <?php endif; ?>-->
                 <br />
             </td>
             <?php if ($isFirst): ?>
@@ -63,7 +63,7 @@
     <?php endforeach; ?>
 <?php endif;?>
 
-<?php if ($this->displayFullSummary() && $_fullInfo && !$this->getIsPlaneMode()): ?>
+<!-- <?php if ($this->displayFullSummary() && $_fullInfo && !$this->getIsPlaneMode()): ?>
 <tr class="tax-total" onclick="expandDetails(this, '.tax-details-<?php echo $taxIter;?>')">
 <?php elseif ($this->displayFullSummary() && $_fullInfo && $this->getIsPlaneMode()): ?>
 <tr class="show-details">
@@ -78,4 +78,4 @@
         <?php endif;?>
     </td>
     <td <?php echo $this->getValueProperties()?>><?php echo $_order->formatPrice($_source->getTaxAmount()) ?></td>
-</tr>
+</tr> -->

mkdir -p ./app/design/frontend/default/default/template/sales/order/
cp ./app/design/frontend/base/default/template/sales/order/totals.phtml ./app/design/frontend/default/default/template/sales/order

--- ./app/design/frontend/base/default/template/sales/order/totals.phtml	2011-06-22 16:05:58.000000000 +0200
+++ ./app/design/frontend/default/default/template/sales/order/totals.phtml	2011-06-22 16:05:47.000000000 +0200
@@ -29,9 +29,7 @@
  */
 ?>
 <?php foreach ($this->getTotals() as $_code => $_total): ?>
-    <?php if ($_total->getBlockName()): ?>
-        <?php echo $this->getChildHtml($_total->getBlockName(), false); ?>
-    <?php else:?>
+    <?php if (!$_total->getBlockName()): ?>
     <tr class="<?php echo $_code?>">
         <td <?php echo $this->getLabelProperties()?>>
             <?php if ($_total->getStrong()):?>
@@ -50,3 +48,11 @@
     </tr>
     <?php endif?>
 <?php endforeach?>
+
+<?php foreach ($this->getTotals() as $_code => $_total): ?>
+    <?php if ($_total->getBlockName()): ?>
+    <tr class="<?php echo $_code?>">
+        <?php  echo $this->getChildHtml($_total->getBlockName(), false); ?>
+    </tr>
+    <?php endif?>
+<?php endforeach?>

Fix Magento 1.4.0.1 PayPal shipping costs bug

wget http://www.boostingecommerce.com/files/Magento_1_4_0_1_PayPal_fix.zip -O /tmp/Magento_1_4_0_1_PayPal_fix.zip
unzip /tmp/Magento_1_4_0_1_PayPal_fix.zip -d /tmp/
cp -a /tmp/Magento_1_4_0_1_PayPal_fix/app/code/local/Mage/Paypal /var/www/app/code/local/Mage/

Links
http://www.magentocommerce.com/bug-tracking/issue?issue=8467
http://www.boostingecommerce.com/fix-for-magento-1-4-0-1-paypal-and-shipping-costs

Magento: Fix PayPal order confirmation email not sent

--- ./app/code/core/Mage/Checkout/Model/Type/Onepage.php.org	2011-04-06 16:23:32.000000000 +0200
+++ ./app/code/core/Mage/Checkout/Model/Type/Onepage.php	2011-04-06 16:43:11.000000000 +0200
@@ -623,13 +623,13 @@
         /**
          * we only want to send to customer about new order when there is no redirect to third party
          */
-        if(!$redirectUrl){
+//        if(!$redirectUrl){
             try {
                 $order->sendNewOrderEmail();
             } catch (Exception $e) {
                 Mage::logException($e);
             }
-        }
+//        }
 
         $this->getCheckout()->setLastQuoteId($this->getQuote()->getId())
             ->setLastOrderId($order->getId())

Links
http://screencastworld.com/2010/03/magento/magento-commerce-how-to-fix-order-confirmation-email-not-sent
http://inchoo.net/ecommerce/magento/debugging-paypal-ipn-in-magento/
http://sergiy.kyrylkov.name/blog/2010/05/payment-problems-in-magento-paypal-standard-with-ipn-after-upgrade-from-1-3-x-to-1-4-0-1/

Magento: change the required / minimum password length

--- ./js/prototype/validation.js.org	2011-03-28 15:40:04.000000000 +0200
+++ ./js/prototype/validation.js	2011-03-28 15:39:46.000000000 +0200
@@ -456,7 +456,7 @@
                     }],
     ['validate-password', 'Please enter 6 or more characters. Leading or trailing spaces will be ignored.', function(v) {
                 var pass=v.strip(); /*strip leading and trailing spaces*/
-                return !(pass.length>0 && pass.length < 6);
+                return !(pass.length>0 && pass.length < 4);
             }],
     ['validate-admin-password', 'Please enter 7 or more characters. Password should contain both numeric and alphabetic characters.', function(v) {
                 var pass=v.strip();

Links
http://www.magentocommerce.com/boards/201210/viewthread/18197/#t62474

Magento: Delete single order

install http://www.magentocommerce.com/magento-connect/EMThemes.com/extension/4562/em_deleteorder

--- ./app/code/community/EM/DeleteOrder/Block/Adminhtml/Sales/Order/Grid.php.org	2011-02-10 16:16:35.000000000 +0100
+++ ./app/code/community/EM/DeleteOrder/Block/Adminhtml/Sales/Order/Grid.php	2011-03-27 18:16:36.000000000 +0200
@@ -50,10 +50,10 @@
      *
      * @return string
      */
-    /*protected function _getCollectionClass()
+    protected function _getCollectionClass()
     {
         return 'sales/order_grid_collection';
-    }*/
+    }
 
     protected function _prepareCollection()
     {
--- ./app/code/community/EM/DeleteOrder/controllers/Adminhtml/Sales/OrderController.php.org	2011-03-27 18:24:57.000000000 +0200
+++ ./app/code/community/EM/DeleteOrder/controllers/Adminhtml/Sales/OrderController.php	2011-03-27 18:25:14.000000000 +0200
@@ -43,6 +43,7 @@
 					$query=null;
 					$order = Mage::getModel('sales/order')->load($orderId);					
 					if($order->increment_id){
+                        $order->delete(); break;
 						/*$query="show tables like 'sales_flat_order'";
 						$rs=$write->fetchAll($query);*/						
 						$incId=$order->increment_id;

Links
http://inchoo.net/ecommerce/magento/delete-test-orders-in-magento/ - Delete test orders in Magento
http://www.magentocommerce.com/magento-connect/EMThemes.com/extension/4562/em_deleteorder - Seamless Delete Order Module
http://www.magentocommerce.com/boards/viewthread/207792/P15/
http://www.magentocommerce.com/boards/viewthread/1680/P345/

Magento: Fix bug in bug in billing / shipping address edit

--- ./app/design/frontend/base/default/template/customer/address/book.phtml.org	2011-03-25 11:54:09.000000000 +0100
+++ ./app/design/frontend/base/default/template/customer/address/book.phtml	2011-03-25 12:38:08.000000000 +0100
@@ -32,7 +32,6 @@
 ?>
 <div class="page-title title-buttons">
     <h1><?php echo $this->__('Address Book') ?></h1>
-    <button type="button" title="<?php echo $this->__('Add New Address') ?>" class="button" onclick="window.location='<?php echo $this->getAddAddressUrl() ?>';"><span><span><?php echo $this->__('Add New Address') ?></span></span></button>
 </div>
 <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
 <div class="col2-set addresses-list">
@@ -56,15 +55,19 @@
         
         <?php if($_pAddsses = Mage::getSingleton('customer/session')->getCustomer()->getDefaultShipping()): ?>
             <li class="item">
-                <h3><?php echo $this->__('Default Shipping Address') ?></h3>
-                <address>
-                    <?php echo $this->getAddressHtml(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?>
-                </address>
-                <p><a href="<?php echo $this->getAddressEditUrl(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?>"><?php echo $this->__('Change Shipping Address') ?></a></p>
+            <h3><?php echo $this->__('Default Shipping Address') ?></h3>
+                <?php if($_pAddsses == Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling()): ?>
+                    <p><?php echo $this->__('Default Shipping Address will use the Billing Address') ?></p>
+                    <p><a href="<?php echo $this->getAddAddressUrl(); ?>"><?php echo $this->__('Add a new address to my address book') ?></a></p>
+                <?php else: ?>
+                    <address>
+                        <?php echo $this->getAddressHtml(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?>
+                    </address>
+                    <a href="<?php echo $this->getAddressEditUrl(Mage::getSingleton('customer/session')->getCustomer()->getAddressById($_pAddsses)) ?>"><?php echo $this->__('Change Shipping Address') ?></a>
+                <?php endif ?>
             </li>
         <?php else: ?>
             <li class="item empty">
-                <h3><?php echo $this->__('Default Shipping Address') ?></h3>
                 <p><?php echo $this->__('You have no default shipping address in your address book.') ?></p>
             </li>
         <?php endif ?>
@@ -88,6 +91,7 @@
             </li>
         <?php endif ?>
         </ol>
+        <button type="button" title="<?php echo $this->__('Add New Address') ?>" class="button" onclick="window.location='<?php echo $this->getAddAddressUrl() ?>';"><span><span><?php echo $this->__('Add New Address') ?></span></span></button>
     </div>
 </div>
 <div class="buttons-set">
--- ./app/design/frontend/base/default/template/customer/account/dashboard/address.phtml.org	2011-03-25 11:42:43.000000000 +0100
+++ ./app/design/frontend/base/default/template/customer/account/dashboard/address.phtml	2011-03-25 12:40:01.000000000 +0100
@@ -28,7 +28,6 @@
     <div class="box">
         <div class="box-title">
             <h3><?php echo $this->__('Address Book') ?></h3>
-            <a href="<?php echo $this->getAddressBookUrl() ?>"><?php echo $this->__('Manage Addresses') ?></a>
         </div>
         <div class="box-content">
             <div class="col-1">
@@ -40,11 +39,23 @@
             </div>
             <div class="col-2">
                 <h4><?php echo $this->__('Default Shipping Address') ?></h4>
-                <address>
-                    <?php echo $this->getPrimaryShippingAddressHtml() ?><br />
-                    <a href="<?php echo $this->getPrimaryShippingAddressEditUrl() ?>"><?php echo $this->__('Edit Address') ?></a>
-                </address>
-            </div>
+                <?php if($_pAddsses = Mage::getSingleton('customer/session')->getCustomer()->getDefaultShipping()): ?>
+                    <?php if($_pAddsses == Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling()): ?>
+                        <?php echo $this->__('Default Shipping Address will use the Billing Address') ?>
+                        <br clear="all" />
+                        <br clear="all" />
+                        <a href="<?php echo $this->getAddressBookUrl() ?>"><?php echo $this->__('Manage Addresses') ?></a>
+                    <?php else: ?>
+                        <address>
+                            <?php echo $this->getPrimaryShippingAddressHtml() ?>
+                        </address>
+                        <br clear="all" />
+                        <a href="<?php echo $this->getPrimaryShippingAddressEditUrl() ?>"><?php echo $this->__('Edit Address') ?></a>
+                    <?php endif ?> 
+                <?php else: ?>
+                    <?php echo $this->__('You have no default shipping address in your address book.') ?>           
+                <?php endif ?>
+            </div> 
         </div>
     </div>
 </div>

German translation (./app/locale/de_DE/Mage_Customer.csv)
"Default Shipping Address will use the Billing Address","Sie haben noch keine Standard Versandadresse. Die Lieferung erfolgt an die Rechnungsadresse."
"Add a new address to my address book","Neue Versandadresse hinzufügen"

Links
http://www.magentocommerce.com/boards/viewthread/7520/

Do you like this page? Then support it. Please click the AD below and visit the sponsor. Thank you!


Syndicate content