开发者

Adding SKU information to Shopping Cart in Magento

开发者 https://www.devze.com 2023-01-28 07:40 出处:网络
开发者_JS百科My client needs to have the sku number, next to the Product Name in the Magento Shopping Cart.I tried adding this code:

开发者_JS百科My client needs to have the sku number, next to the Product Name in the Magento Shopping Cart. I tried adding this code:

<?php echo $this->__('Style Number : %s', $_product->getSku()) ?>

but I get this message:

"Fatal error: Call to a member function getSku() on a non-object."

I would appreciate any help.

Thank you.


If you edit DOCROOT\app\design\frontend\default\themename\template\checkout\cart\item\default.phtml and add

<?php echo $_item->getSku() ?>

That should work.

JD


http://www.woolleydesign.net/2011/05/magento-adding-short-description-to-the-shopping-cart/

Got some assistance from here as well, great post for any others interested


The line:

<?php echo $_item->getSku() ?>

inserted in:

app\design\frontend\default\themename\template\checkout\cart\item\default.phtml

exactley above line:

<?php if ($_options = $this->getOptionList()):?>

as per the above Mike answer solved for me one of the main problems. Is working well also with SCP installed. I got, in the cart, the SKU of the selected simple object associated to a configurable product.

I am on Magento 1.6.2. PERFECT.

Thanks Jonathan, thanks Mike, thanks to all.


Works perfect - only one piece of advice for some uncertain where to drop this code.

I added it after line 37 in default.phtml after the closure

Reason being is in the wrong place it won't show up under the product name if I add it after line 27.

My lines 37-39 on Magento 1.5 for default.phtml mentioned above

</h2>
    <?php echo $_item->getSku() ?>
<?php if ($_options = $this->getOptionList()):?>
0

精彩评论

暂无评论...
验证码 换一张
取 消