Try the Demo

Magento Forum

   
[ASK FOR HELP] How to Code
 
alkarim
Guru
 
Total Posts:  368
Joined:  2008-04-10
 

hi all , how to call all products name, price, url (all attribute) in magento.

thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
alkarim
Guru
 
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

 
Magento Community Magento Community
Magento Community
Magento Community
 
crius
Guru
 
Avatar
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)

 
Magento Community Magento Community
Magento Community
Magento Community
 
alkarim
Guru
 
Total Posts:  368
Joined:  2008-04-10
 

yeah, its great but I still can’t make it.

it says :

Fatal errorCall to a member function getName() on a non-object in ../app/design/frontend/default/default/template/catalog/product/feed.phtml on line 37

 
Magento Community Magento Community
Magento Community
Magento Community
 
crius
Guru
 
Avatar
Total Posts:  623
Joined:  2007-10-16
Denmark
 

Well, what have you done? Tell me what code you have written.

(By the way, the post you just made says “Posted: 11 months ago” in my browser… confused )

 Signature 

Anders Rasmussen | Crius
criuscommerce.com Magento extensions
crius.dk Magento services (in Danish)

 
Magento Community Magento Community
Magento Community
Magento Community
 
alkarim
Guru
 
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() ?>

 
Magento Community Magento Community
Magento Community
Magento Community
 
crius
Guru
 
Avatar
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)

 
Magento Community Magento Community
Magento Community
Magento Community
 
alkarim
Guru
 
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

 
Magento Community Magento Community
Magento Community
Magento Community
 
crius
Guru
 
Avatar
Total Posts:  623
Joined:  2007-10-16
Denmark
 

Can’t you just add those attributes to the array in addAttributeToSelect and then pull them out in the same way as the other attributes?

 Signature 

Anders Rasmussen | Crius
criuscommerce.com Magento extensions
crius.dk Magento services (in Danish)

 
Magento Community Magento Community
Magento Community
Magento Community
 
alkarim
Guru
 
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 ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
crius
Guru
 
Avatar
Total Posts:  623
Joined:  2007-10-16
Denmark
 

What category do you mean? We are talking about a product now, and a product can have several categories.

 Signature 

Anders Rasmussen | Crius
criuscommerce.com Magento extensions
crius.dk Magento services (in Danish)

 
Magento Community Magento Community
Magento Community
Magento Community
 
alkarim
Guru
 
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 ?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top