Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. Mage::getResourceSingleton('catalog/product')
  2. ->getAttributeRawValue($productId, 'attribute_code', Mage::app()->getStore());
  3.  
  4. Mage::getResourceSingleton('catalog/product')
  5. ->getAttributeRawValue($productId, 'url_key', Mage::app()->getStore());
  6.  
  7. $product_collection = Mage::getModel('catalog/product')->getCollection()
  8. ->addAttributeToFilter('entity_id', 16)
  9. ->addUrlRewrite();
  10. $product_collection_url = $product_collection->getFirstItem()->getProductUrl();
  11.  
  12. $_item = Mage::getModel('catalog/product')->getCollection()
  13. ->addAttributeToSelect('product_url')
  14. ->addAttributeToFilter('entity_id', $productId)
  15. ->addUrlRewrite()
  16. ->load();
  17.  
  18. foreach($_item as $product){
  19. echo $product->getProductUrl();
  20. }
  21.  
  22. // returns string "http://www.your-domain.com/[category]/[product_url]"
  23.  
  24. Mage::getResourceSingleton('catalog/product')
  25. ->getAttributeRawValue($productId, 'url_key', Mage::app()->getStore());
  26.  
  27. // returns string "product-url-like-this"
  28.  
  29. $productUrl = Mage::getResourceModel('core/url_rewrite')
  30. ->getRequestPathByIdPath('product/' . $productId, $storeId);
  31. // returns string "product-url.html"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement