Saturday 14 December 2013

Save Shipping address same as billing in magestore giftvoucher and display in backend order view

If you are using Magestore giftvoucher and using by email options then it will hide shipping address option and also consider it as virtual product.

so if you want to save shipping address same as billing address then do follow these simple steps.

1) Edit  app/code/local/Magestore/Giftvoucher/Model/Observer.php file
go to orderPlaceBefore function and add these lines 



    $order = $observer->getEvent()->getOrder();
    $billing_address = $order->getBillingAddress();
    $shippingAddress = Mage::getModel('sales/order_address')
        ->setCustomerId($billing_address->getCustomerId())
        ->setCustomerAddressId($billing_address->getCustomerAddressId())
        ->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_SHIPPING)
        ->setFirstname($billing_address->getFirstname())
        ->setMiddlename($billing_address->getMiddlename())
        ->setLastname($billing_address->getLastname())
        ->setSuffix($billing_address->getSuffix())
        ->setCompany($billing_address->getCompany())
        ->setStreet($billing_address->getStreet())
        ->setCity($billing_address->getCity())
        ->setCountry_id($billing_address->getCountryId())
        ->setRegion($billing_address->getRegion())
        ->setRegion_id($billing_address->getRegionId())
        ->setPostcode($billing_address->getPostcode())
        ->setTelephone($billing_address->getTelephone())
        ->setFax($billing_address->getFax());

    $order->setShippingAddress($shippingAddress);
 
If you want more data to save then you can add more fields in above code depends on your requirement.
 
By adding above code shipping address will be  saved same as shipping address.

Now if you want to display shipping address in backend order view page.

then open app/design/adminhtml/default/default/template/sales/order/view/info.phtml and at the end 
of the code you will find

<?php if (!$this->getOrder()->getIsVirtual()): ?>

you need to remove comment from here or also add condition for giftcard to display shipping address.


Enjoy and Good luck Friends.. :)
 
Reference link:  
 
http://goo.gl/ZwRhT3

Tuesday 3 December 2013

Magento Product Custom Option Template Extension

This extension will help you to create Product custom options template which can be used in product custom options tab. when there are so many products and options are same or little bit different then this extension is very useful. Its very simple and helpful easy to use.

Magento Supported version 1.7


Download Extension