Show products in grid
-
16-10-2019 - |
سؤال
I create my theme for magento and i can't show products in grid mode on my homepage.
I use this to show all products on my homepage but products is in list mode.
{{block type="catalog/product_list_random" name="product_random" template="catalog/product/list.phtml"}}
Here is my catalog.xml and my list.phtml
Can you tell me what i need more to add for this grid mode?
المحلول
try {{block type="catalog/product_list_random" name="product_random" mode="grid" template="catalog/product/list.phtml"}}
It should work.
Your problem is in view.phtml
here:
<?php if($this->getMode()!='grid'): ?>
so what you need is to set $this->getMode()
to grid
.
If you have a look into the List.php
:
public function getMode()
{
return $this->getChild('toolbar')->getCurrentMode();
}
So you need to pass grid
into $toolbar->setData('_current_grid_mode', 'grid')
but I have no idea, how to do this.
So I see two possibilities here:
- You copy the template and remove the list mode (bad idea)
- You change the template the way, so that the grid mode is the default
لا تنتمي إلى magento.stackexchange