Open the category in the admin area (backend) and add the following xml to the layout update section.
|
1 2 3 |
<reference name="product_list"> <action method="setColumnCount"><count>4</count></action> </reference> |
Open the category in the admin area (backend) and add the following xml to the layout update section.
|
1 2 3 |
<reference name="product_list"> <action method="setColumnCount"><count>4</count></action> </reference> |
Searching for something while being on a https secured page opens a warning dialog. Thats annoying for the visitor of your page. To fix that problem, open a suitable module or create a new one and add the following xml…
Using the code below you can call a stored procedure directly from Magento.
|
1 2 3 4 |
$resource = Mage::getSingleton('core/resource'); $readConnection = $resource->getConnection('core_read'); $query = 'CALL stored_procedure()'; $results = $readConnection->exec($query); |
Use the code below to redirect to any page from a Magento template (phtml) file. In this case, it is a redirect to the home page.
|
1 |
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getBaseUrl()); |
Add the following code to your themes catalog\product\list.phtml file. It will change the column count to 2.
|
1 |
$this->setColumnCount(2); |
The below code shows how to echo the HTML of a block with the id ‘my_block’.
|
1 |
echo $this->getLayout()->createBlock('cms/block')->setBlockId('my_block')->toHtml(); |
One step towards making your shop more secure is to change the default admin route from http://www.your-shop.com/admin to something more secure and less guessable. The route must be changed in app/etc/local.xml.
|
1 2 3 4 5 6 7 8 9 |
<admin> <routers> <adminhtml> <args> <frontName>your-new-backend-route</frontName> </args> </adminhtml> </routers> </admin> |
After adding that to your app/etc/local.xml file, clear…
The following code returns all products from within a certain category in a collection.
|
1 2 3 |
// category id = 5 // addAttributeToSelect is optional $products = Mage::getModel('catalog/category')->load(5)->getProductCollection()->addAttributeToSelect('*'); |
The following MySQL query returns all Magento orders that have at least one item with attribute set id 9.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
/* 9 = attribute set Id */ select increment_id, created_at, entity_id from sales_flat_order where entity_id not in ( SELECT o.entity_id FROM sales_flat_order o LEFT JOIN sales_flat_order_item i ON o.entity_id = i.order_id LEFT JOIN catalog_product_entity p ON i.product_id = p.entity_id WHERE p.attribute_set_id = 9 ) |
The following MySQL query deletes all rows from the Magento compare list table.
|
1 |
delete from catalog_compare_item; |