magento static block error in admin - php

I have added the 2 static block codes to a CMS page in magento inside a DIV.
<div class="WTcontainerTop">
{{block type="cms/block" block_id="TW_intro"}}
{{block type="cms/block" block_id="TW-Tour"}}
</div>
After saving the page, it looks like the below although the frontend page looks fine.
<div class="WTcontainerTop">http://everydaycashmere.com/index.php/admin/cms_wysiwyg/directive/___directive/e3tibG9jayB0eXBlPSJjbXMvYmxvY2siIGJsb2NrX2lkPSJUV19pbnRybyJ9fQ,,/key/ba3c67e3bc929ae08551768624139371/ {{block type="cms/block" block_id="TW-wardrobe-Grand-Tour"}}</div>
I have tried to fix in a number of times and I don't get this error on other pages. Can anyone help please.

I don't know that the method of adding static block you tried is correct or not.You can do it by:
Clicking on "Insert Widget" on "Content" portion of 'CMS Page'.
Then select the Widget type to "CMS static Block".Then select the static block you want to add.
This process will add a static block in your cms page.
Hope this will help.

Related

Customer Registration Form Template Not Working On Site Home Page

I am trying to call Magento customer registration form on my home page. When I call it on the home page I try both ways, static block or template.phtml file and my site stops working. Can anyone suggest a solution to me?
<?php
echo $this->getLayout()->createBlock('cms/block')->setBlockId('register-form')->toHtml();
<?php
echo $this->getLayout()->createBlock('core/template')->setTemplate('persistent/customer/form/mini.register')->toHtml();
when using a template file, add the '.phtml' extension to the name of the file.
in your example:
echo $this->getLayout()->createBlock('core/template')->setTemplate('persistent/customer/form/mini.register.phtml')->toHtml();
please not that the code above will only work in template files.
if you are trying to add this to your homepage through the admin cms page, then you would do this:
{{ block type="core/template" template="persistent/customer/form/mini.register.phtml" }}
or through a layout file:
<block type="core/template" template="persistent/customer/form/mini.register.phtml" />

How to call the Search bar from homepage to all other pages in Magento 1.9?

My Search bar is currently on my homepage(http://www.ashvinrx.com/magento/index.php/).
block type="core/template" name="top.search" as="topSearch" template="catalogsearch/form.mini.phtml"/>
I want to make the search bar appear on my 'newproducts' page (http://www.ashvinrx.com/magento/index.php/newproducts).Please help.
It looks like this is cms page.
you can add this code in that page {{block type="core/template" name="top.search" template="catalogsearch/form.mini.phtml"}}
and search bar will appear on that page. and if you want to display this in any specific place let me know i will guide you with this.
You can try this code also in phtml file.
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('catalogsearch/form.mini.phtml')->tohtml(); ?>
For Magento recent versions try this format below:
<?php echo $this>getLayout()createBlock('Magento\Framework\View\Element\Template')->setTemplate('Magento_Search::form.mini.phtml')->toHtml() ?>

Magento: how to call static block in category page within content

I am trying to call a static cms block with id BLOCKID from within the content section of the category. I tried using the following and it doesn't work:
{{block type="cms/block" block_id="BLOCKID"}}
I am able to call it using Custom Layout Update using the following code but it doesn't allow me control over the location where within content it will appear.
<reference name="content">
<block type="cms/block" name="BLOCKID">
<action method="setBlockId"><block_id>BLOCKID</block_id></action>
</block>
</reference>'
There is a specific section in my text located in the content section where I want this block to appear.
Any help would be appreciated.
If you want to stick a static block into category content, there is an easy workaround. To keep things straight for this example, let's say the category is "Cameras" and your static block is "camera-deals".
Go to your category, copy all of the content.
Create a new static block named "cameras-content" or something similar
Paste your category content into this new static block, insert your existing "camera-deals" static block where you want it to go. Save
Return to the category, delete the content that you previously copied
In the Display tab, set Display Mode -> Static Block (can be either just the static block or with products, both work)
Choose the "cameras-content" for your static block (this block can have variables and static blocks inside of it.) Save
Basically, it's easy to call files in the media folder, variables, blocks, and widgets from a static block...but out of the box you can't do that in category content. So just don't do that, haha. Have your category refer to a static block and then do all of your fancy things in that block.

Pass variable from inline block to template file in magento

I have in the magento home content
{{block type="catalog/navigation" template="catalog/navigation/sub_navigation.phtml"}}
This is calling a set of subcategorys of the given parent category ID.
Now I want to influence my $parent_category already from this given block. I found How to pass variable from block to phtml in magento but they don't show the same way of notation.
How to integrate the setData action into the given block notation?
Thanks for your help!
You can pass data like below mention method
{{block type="catalog/product_list" name="Custom Block" category_id="68" column_count="3" product_count="3" template="catalog/navigation/sub_navigation.phtml"}}
after that in phtml file you can get data by below mention method
$this->getCategoryId();
or $this->getData('category_id');
Thanks.

Magento catalog - Duplicate category using static block

In the web-shop i'm creating we want the customers to see the category new as they are landing in the shop.
Our configuration in the whole catalog is an layout of 4 items next to each other, like below:
four items in one row
*sorry i am not yet allowed to post pictures :(
I've made an static block in Magento using the following code:
{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" category_id="7" template="catalog/product/list.phtml"}}
But when i call this block at the place I wan't it to display, it does not use the correct layout:
3 items in one row, two rows
*sorry i am not yet allowed to post pictures :(
It only put's 3 items next to each otter. I've already tried tweaking the css but that's not the problem. The page code shows that it is put in another row:
<ul class="products-grid first odd"> (the first row)
<ul class="products-grid last even"> (the second row)
My guess is that when i call the block it sets the display to 3 items a row, but i can't figure out where that configuration is located.
Way 1:
for you to use modificated template catalog/product/list.phtml
Create new template from this one and call it list-home.phtml and where you have grid mode view you must have something like this:
<?php $_columnCount = $this->getColumnCount(); ?>
replace this with
<?php $_columnCount = 4; ?>
Way 2: Add this block via layout or custom layout in admin area and add to it params like:
<action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
Sorry - second way would not work via static block - you can add this w/o static block directly in Layout Update XML in CMS home page, also I don't understand for what you using static block for this if you can add this code for block directly in CMS Page content too

Categories