alkarim
Total Posts: 368
Joined: 2008-04-10
hi all , how to call all products name, price, url (all attribute) in magento.
thanks
Posted: June 7 2008
| top
alkarim
Total Posts: 368
Joined: 2008-04-10
hi bro, I need to know how to show price, category, description, short description, quantity, manufacturer in magento
thnkas
Posted: June 7 2008
| top
| # 1
crius
Total Posts: 623
Joined: 2007-10-16
Denmark
If you are talking about how to display that information from a template, take a look at app/design/frontend/default/default/template/catalog/product/view.phtml. That is the template for viewing a product.
Signature
Anders Rasmussen | Crius
criuscommerce.com Magento extensions
crius.dk Magento services (in Danish)
Posted: June 7 2008
| top
| # 2
alkarim
Total Posts: 368
Joined: 2008-04-10
yeah, its great but I still can’t make it.
it says :
Fatal error : Call to a member function getName () on a non - object in ../ app / design / frontend /default/default/ template / catalog / product / feed . phtml on line 37
Posted: June 7 2008
| top
| # 3
alkarim
Total Posts: 368
Joined: 2008-04-10
at app/code/core/Mage/Catalog/Block/Product/Feed.php
public function getProduct () { return $this -> getQuote ()-> getAllItems (); }
at default/default/template/Catalog/Product/feed.html
<?php $_product = $this -> getProduct () ?>
Posted: June 7 2008
| top
| # 5
crius
Total Posts: 623
Joined: 2007-10-16
Denmark
Okay, well I have no idea what that is. I have no product feed block or template in my install, so I assume you made it yourself. But surely, you gotta have more code than that to accomplish anything.
Signature
Anders Rasmussen | Crius
criuscommerce.com Magento extensions
crius.dk Magento services (in Danish)
Posted: June 7 2008
| top
| # 6
alkarim
Total Posts: 368
Joined: 2008-04-10
hi , I found the code for all products that we created at backend;
at feed.php
$storeId = Mage :: app ()-> getStore ()-> getId (); $product = Mage :: getModel ( 'catalog/product' ); /* @var $product Mage_Catalog_Model_Product */ $todayDate = $product -> getResource ()-> formatDate ( time ()); $products = $product -> setStoreId ( $storeId )-> getCollection ()-> addAttributeToSelect (array( 'name' , 'price' , 'small_image' ), 'inner' ); $this -> setProductCollection ( $products );
at frontend feed.phtml
if (( $_products = $this -> getProductCollection ()) && $_products -> getSize ()) : foreach ( $_products -> getItems () as $_product ) : $sku = $_product -> sku ; $product_url = $_product -> getProductUrl (); $img_url = $_product -> getImageUrl (); $product_title = $this -> htmlEscape ( $_product -> getName ()); $category = $_product -> getCategory (); $price = '$' . $_product -> getPrice (); $stock_status = $_product -> getData ( 'stock_item' )-> is_in_stock ; } }
but still I wonder for the product manufacturer & product short description & product description.
please , help
Posted: June 9 2008
| top
| # 7
alkarim
Total Posts: 368
Joined: 2008-04-10
hi @anders, you’re right
here is my code to show the short description :
$products = $product -> setStoreId ( $storeId )-> getCollection () -> addAttributeToFilter ( 'home_page_f2' , array( 'yes' => true )) -> addAttributeToSelect (array( 'name' , 'price' , 'small_image' , 'short_description' ), 'inner' ) -> addAttributeToSelect (array( 'special_price' , 'special_from_date' , 'special_to_date' ), 'left' );
and
echo '<br /><br />' . $_product -> getShortDescription ();
thanks for your fast reply
anyway, how should I do for displaying the category’s url ?
Posted: June 10 2008
| top
| # 9
alkarim
Total Posts: 368
Joined: 2008-04-10
that’s it… a product could have a category name even sub category name…
I need to display it on my homepage feature…
I need to display category of products that I have…
is there any solution for this ?