Blogs of e-commerce

We are a web development and outsourcing agency based in Kochi, India.

Estimating Shipping Rate on Product Details Page in Magento

To display the shipping rates on the product view page in Magento 2, you can use a custom block and template. Just follow these simple steps to make it happen: Create a Custom Module: If you don't have a custom module yet, it's a great idea to create one following the best practices for module creation in Magento 2. Create a Block Class: In your custom module, let's create a block class to handle the super cool logic for obtaining shipping rates! <?php // File: app/code/YourVen...

Setting the ‘continue shopping’ URL to last product’s category page in magento

Here is a code snippet for setting the ‘Continue Shopping’ location to the category listing page of the last product added to the cart. Open the template/checkout/cart.phtml file in your active theme. Place the following code in the foreach loop

(ie. after this line of code)

< ?php foreach($this->getItems() as $_item): ?>

that generates the products list in the cart.

< ?php
$_categories = $_item->getProduct()->getCategoryIds();
$_category = Mage::getModel(‘catalog/category’)->load($_categories[0]);
$url = $this->getUrl($_category->getUrlPath());
Mage::getSingleton(‘checkout/session’)->setContinueShoppingUrl($url);

?>

You are done!

Page 2 of 212
2hats Logic HelpBot