Use if else in magento homepage content - magento

I am trying to display a grid view with sale items shown on the homepage filtered by category.
I tried to put php if/else block in the homepage content in CMS section of admin, but it doesn't work. Any PHP code in the CMS is being commented automatically!
Is there any other way to filter homepage sale/featured products by category? I am using Magento 1.7.x
I have added the following code into the homepage which works:
{{block type="catalog/product_special" template="catalog/product/list1.phtml"}}
I just want to filter result of above code using categories when the user clicks on a category link on the homepage itself (not on the main menu)
Thanks
Anyone please?

Try this if/else syntax from the cms (using the customer group reference strictly as an example)...
{{if customer.group_id==4}} Print true {{else}} Print false {{/if}}

Related

How to show products on magento 1.9 home page?

{{block type=”catalog/product_new” name=”home.catalog.product.new”
alias=”product_homepage” template=”catalog/product/new.phtml”}}
I am using this code to display my all products on homepage screen but still I am not able to view any product.
I am using this code on CMS->pages->home page-> content
As you have using magento c.E 1.9 version and this version already applied magento patch SUPEE-6788.
So,you need to remove catalog/product_list from white list
System > Permissions > Blocks
Add New Block
Block Name: catalog/product_list
Is Allowed : Yes
you need to follow below step
you have to add this category_id="categoryId" in block
CategoryId = which Category's products you want to show
OR
If above code does not help you please this one
Go to “CMS - Manage Pages” and select “Home Page” from the list of pages.
Use this code snippet to show one category on your front page:
{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" template="catalog/product/list.phtml"}}

how to add products in magento 1.9 in front end

Now i have installed magento 1.9 .
My page look like this http://imgur.com/ntIJvzs
I want to know how to add products without using sample data.
Can you help me?
GO to Catalog- Products - Manage Products click on Add Product button in right top.
Insert all required fields.
To display in front end it must be in stock so go to inventory select In Stock and Quantity greater than zero.
And It must be added to a category to display in category view [to add a category go to Catalog - Manage categories ] or else to view the product you might need to search for it.
the best place to find information about the general setting up of Magento is the Magento Knowledge Base. As for adding products, I recommend adding categories first so that visitors can navigate to the products. The article for that is at http://www.magentocommerce.com/knowledge-base/entry/tutorial-creating-and-managing-categories. Once you have categories, they can be assigned to products as they are added following the article at http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/adding-a-new-product.
To show products from a specific category, get the category ID from admin, and include it on your home page's CMS content using the code (changing the category ID of course):
{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" category_id="4" template="catalog/product/list.phtml"}}

Magento: Insert CMS Page inside the product description

By using this code in the product description WYSIWYG editor, you can display a CMS block
{{widget type="cms/widget_block" template="cms/widget/static_block/default.phtml" block_id="01"}}
I am wondering, is there any way i can do the same with a CMS Page ?
Can i display a CMS page inside the product description from the WYSIWYG editor?
This will not work, since the product description is not passing the magento template filter system!
You could create your own widget, see Creating a Magento Widget
Then implement your logic to get cms content
protected function _toHtml()
{
//get cms content from db
}
there is a work around for it..you can try to pull the content of the cms page in your product view template file... ie in catalog/product/view.phtml file
refer here (How to call a cms page in a phtml file in magento?)

how to show parent category on 2columns-right.phtml without put block in cms page in magento

i want to show all parent category without using block section.i want to put code in cms page so please help i tried lots of code but that didn't work
filename:- 2columns-right.phtml

Combine list.phtml & view.phtml together

Hello all i need to display product detail page right under category page so as you click on the category image it will display the same product details right under the same page.Also when user clicks on any category it comes with all products & with details of first item in list. Is it possible in magento & if yes then how can i do it. I am new in magento but it seems to me a great framework to work with. Please help me Thanks
To show product detail page on category page you have to make ajax request and get the whole detail and insert into div located at bottom of category page.
Follow this link
Magento - AJAX Call Product Page Elements to Category Page. Select Box Not Populated

Resources