php - How to get catalog product data in Magento 1.8? -


I use these lines below to get the CMS page data,

  // Get current message from CMS page: getSingleton $ cms_id = Dana :: getSingleton ('cm / page') - & gt; GetIdentifier (); $ Cms_title = Dana :: getSingleton ('cm / page') - & gt; GetTitle (); $ Cms_content = Dana :: getSingleton ('cm / page') - & gt; GetContent (); Var_dump ($ cms_content);   

What if I want to receive a catalog product data? I want to get the name of the product for example,

  $ _ assistant = $ this-> Assistant ('list / output'); $ Product_id = Dana :: getSingleton ('list / product') - & gt; GetIdentifier (); $ Product = Dana :: MillModel ('catalog / product') - & gt; Load ($ product_id); Echo $ _helper- & gt; ProductActivate ($ _products, $ _product- & gt; getName (), 'name');   

Result,

Fatal error: Call a member function at getName () on a non-object in C: \ wamp \ www \ mywebiste.com \ App \ Design \ foreground \ mywebsite \ default \ template \ page \ html \ banner.phtml on line 6

Any ideas?

Special category / product list You can use the code below to get product data < / P>

  $ id = 3; // need to keep a special category $ id near store_id = 1; // is required to pass Store ID if you have $ storeCategory = Mage :: getModel ('catalog / category') - & gt; SetStoreId ($ store_id) - & gt; Load ($ ID); $ Collection = $ current-class- & gt; GetProductCollection (); $ COLLECTION- & gt; Load (); Foreign Currency ($ $ Collection as Product): $ product = Dana :: MillModel ('catalog / product') - & gt; Load ($ product-> ICID ()); // Special ID Products $ product_id = $ Product- & gt; GetId (); $ product_name = $ product- & gt; Mix (); $ Product_price = $ product- & gt; Milpris (); $ Product_img = Mage :: getModel ('catalog / product_media_config') - & gt; GetMediaUrl ($ product-> getImage ()); Endforeach;    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -