I have Magento shop installed at e.g mywebsite.com/shop
On main page of mywebiste.com (which is powered by Wordpress) I would like to embed a block with few products from certain category.
How could I achieve it programatically?
Basically, I have two ideas, but maybe it is not the best way of doing, moreover I have never used wordpress.
- develop a module on your website, reading in Magento’s database
- develop a Magento’s module that returns products informations in an plugable way : an RSS feed for example. So, you may design an interface to configure that feed’s products. Then, include a (custom?) feed-burner widget in your wordpress.
I would like to know what to do (in php) in order to access magento’s core and fetch products as php arrays or php objects - avoiding direct reading from database.
Wordpress - I mentioned it just for illustration - It can be blank php page - what’s important: it must be outside of main magento path.
I would like to know what to do (in php) in order to access magento’s core and fetch products as php arrays or php objects - avoiding direct reading from database.
Wordpress - I mentioned it just for illustration - It can be blank php page - what’s important: it must be outside of main magento path.
Regards,
Maciek
How do you make those arrays/objects available to the PHP process on the other webserver? There has to be a translation layer somewhere.
I have Magento shop installed at e.g mywebsite.com/shop
On main page of mywebiste.com (which is powered by Wordpress) I would like to embed a block with few products from certain category.
How could I achieve it programatically?
Regards,
Maciek
As with all data transfer problems you have 2 options, push or pull.
Push would involve making changes to magento, as your update your static blocks or categories, you would write out a chunk of static HTML to a spot on the drive. The WP page can simply include this file, or transfer it across servers and include a local copy (if the WP and Mage are on different servers).
A Pull solution is probably more what you were thinking. It would involve making a new module that would only create a catalog/category_list type block and transfer the data to your WP server. With this type of solution you can give out all different kinds of data. You can spit out complete HTML, as in the push solution, you can give an RSS stream and use php in WP to arrange it into HTML, you can give SOAP, or generic XML, JSON, WDDX, or whatever serialization you want.
I can pretty much guarantee you that any pull solution will not scale and you will see it as being slow after a while. A pull with a significant cache timeout would probably be the best of both worlds since it wouldn’t involve hooking into admin events to watch for changes to categories or static blocks.
That is just a guess as to which URL the CMS page would have from the first step.
You can also create your own file and activate this block in a shell magento script. This solution is too complicated to detail here, but this can get you started.
Hi Mark!
Thanks for a tip. I created new page and used iframe on second page.
You can also create your own file and activate this block in a shell magento script. This solution is too complicated to detail here, but this can get you started. ...
hm hm, it’s better. I have a name of product. But:
Book 2008 (SP 60)
Notice: Undefined variable: _product in /home/mimo/Documents/www/app/design/frontend/default/default/template/mystuff/wp_export/product_list.phtml on line 7
[0] in include("/home/mimo/Documents/www/app/design/frontend/default/default/template/mystuff/wp_export/product_list") in /home/mimo/Documents/www/app/code/core/Mage/Core/Block/Template.php on line 112
[1] in Mage_Core_Block_Template->fetchView("frontend/default/default/template/mystuff/wp_export/product_list.phtml") in /home/mimo/Documents/www/app/code/core/Mage/Core/Block/Template.php on line 144
[2] in Mage_Core_Block_Template->renderView() in /home/mimo/Documents/www/app/code/core/Mage/Core/Block/Template.php on line 183
[3] in Mage_Core_Block_Template->_toHtml() in /home/mimo/Documents/www/app/code/core/Mage/Core/Block/Abstract.php on line 552
[4] in Mage_Core_Block_Abstract->toHtml() in /home/mimo/Documents/www/pok.php on line 9
Fatal error: Call to a member function getRatingSummary() on a non-object in /home/mimo/Documents/www/app/code/core/Mage/Review/Helper/Product.php on line 35
The Book is a simply product without special attributes (Default product).