Magento News
Get by SKU instead of Product ID
by fRAiLtY (Posted Thu, 25 Mar 2010 13:54:37 GMT)
Hi guys,
I’m currently using this code in a .phtml file
- Code:
<?php
$productId = $this->getProduct_id();
$product = Mage::getModel('catalog/product')->load($productId);
?>
<a href="<?php echo $product->getProductUrl() ?>" >
£;<?php echo number_format($product->getPrice(),2); ?>
This when called via a static block gets a product by ID number and displays it whereever I display the static block. I want to change the variable to SKU, but I can’t figure it out and keep breaking it.
I use this code in the static block:
- Code:
{{block type="catalog/product_view" product_id="1" template="catalog/product/matrix.phtml"}}
Where matrix.phtml is the first piece of code. How do I change either to do exactly the same thing just by SKU instead of ID?
Cheers
http://magento-forum.co.uk/viewtopic.php?f=3&t=172#p638
Possibly Related Posts:
- Australia Post e-Parcel
- Newbie!
- Strategic Theme http://t.co/Y1uyNPMU – visit my Site for more #wordpress #joomla #drupal #magento Themes
- RT @ArnaudLigny: Magento : Du changement dans l’air ! | Ecommerce Squad : le Ecommerce, coté technique – http://t.co/NKzFjfAI
- @d8bhatta Hi Deepak, you just followed logic and I run that account. Can you follow me and can we talk re magento john@logicrec.com
RSS Feed