I am developing an online store in magento.I am editing the default theme of magento according to my new theme.
I wanted to know how can I call new css and js file to my default theme.
I tried making a blocktype in layout/page.xml like:-
<action method="addCss"><stylesheet>css/styles.css</stylesheet></action>
<action method="addCss"><stylesheet>css/bootstrap.css</stylesheet></action>
<action method="addItem"><type>skin_css</type><name>css/styles-ie.css</name><params/><if>lt IE 8</if></action>
css/widgets.css
css/print.cssmedia="print"
i want to add bootstrap.css file to my theme but its not included in the meta tag
Please help me
use
<reference name="head">
<action method="addCss">
<style>css/filename.css</style>
</action>
</reference>
Related
I am using magento 1.7. In my home page each category has pagination and the pagination appears in both top and bottom of the each category. I want to remove pagination from top and keep pagination in bottom.
For including pagination, I used the following code,
CMS > Pages > Design > Layout Update XML
<reference name="content">
<block type="catalog/product_list" name="home" template="catalog/product/list.phtml">
<action method="setCategoryId"><category_id>137</category_id></action>
<action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
</block>
<action method="setToolbarBlockName"><name>product_list_toolbar</name><count>5</count></action>
</block>
</reference>
Hello for pagination use gettoolbarhtml() check following file
/app/design/frontend/default/your_theme/template/catalog/product/list.phtml
comment below line
// echo $this->getToolbarHtml()
You can achieve your goal with something like this:
<reference name="your_parent_block_name">
<remove name="block_name_you_want_to_remove"/>
</reference>
I seem to be having a problem identifying how to restrict Joomla 2.5 back-end users to specific features / Views in a custom component I am writing. According to my understanding I should be able to add my views as a section in the access.xml file. I have attempted this by naming a section the same name as my view but I don't seem to be able to change the access to that view independently from the component as a whole. Does anybody have a more in depth example I can review or tips? Is this even possible?
I believe what you are trying to do is not supported by Joomla.
My suggestion is to add a custom rule for views in access.xml
<section name="component">
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_CATEGORIES_ACCESS_EDITSTATE_DESC" />
</section>
<section name="views">
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
</section>
Then save your view in the #__assets table with a name like com_component.view.playerlist,
in the rules field you should save a JSON encoded list of your rules:
{"core.admin":{}}
You can check if current user can or cannot access a determinate section using JAccess
$user_id=JFactory::getUser()->id;
$has_permission = JAccess::check($user_id,'core.admin','com_component.view.playerlist');
if($has_permission){
draw_view();
}else{
JError::riseError(403,JText::_('PERMISSION_DENIED'));
// or
JError::raiseWarning(403,JText::_('PERMISSION_DENIED'));
}
If you have any doubt, feel free to comment.
I had created a static block containing images aligned vertically then I added an xml block for calling it in the right column in catalog.xml.
Now it is showing that block on all pages .
BUt I dont want just this specific block to be displayed on detail page . So how can I restrict it not to be shown on detail page while showing on rest of the pages.
I did tried to remove it by this:
<remove name="right.info" />
And this is the block I'm calling:
<block type="core/text_list" name="banners">
<block type="cms/block" name="right.info">
<action method="setBlockId"><block_id>right_logos</block_id></action>
</block>
</block>
<reference name="banners">
<action method="unsetChild"><name>right.info</name></action>
</reference>
I have a "auth-redirect" module that is in the beginning of all my page layout files (1column, 2column, etc). This works to make sure that before rendering any page, if the user is not authenticated properly then it redirects to a login page.
The way that I allow the login page to render is in my customer.xml file I declare the following:
<customer_account_login>
<remove name="auth-redirect"/>
...
</customer_account_login>
This works fabulously.
However I recently created another module custom module and when I go to the urls that engage that module's controller and render the modules layout the auth-redirect stays in the page and thus I always get redirected.
The custom module layout looks like this:
<shipment_management_index>
<remove name="auth-redirect"/>
<reference name="content">
<block type="custom/vendor_shipment_info" template="custom/vendor/shipment/info.phtml" name="info"/>
</reference>
</shipment_management_index>
Now, I've gone to the page and using Alan Storm's showLayout module gotten the output from ?showLayout=page. You can see that the element for auth-redirect is in the page, down below the body, but at the top auth-redirect is still in the page. What am I missing?
<layout><block name="formkey" type="core/template" template="core/formkey.phtml"/>
<block type="page/html" name="root" output="toHtml" template="page/1column.phtml">
<block type="page/html" name="auth-redirect" as="auth-redirect" template="page/html/auth-redirect.phtml" ignore="1"/>
<block type="page/html_head" name="head" as="head">
...
</block>
...
<remove name="auth-redirect"/>
<reference name="content">
<block type="custom/vendor_shipment_info" template="custom/vendor/shipment/info.phtml" name="info"/>
</reference>
</reference></layout>
Is your last piece of code in the same file ? If so, why not trying to comment/delete the first
<block type="page/html" name="auth-redirect" as="auth-redirect" template="page/html/auth-redirect.phtml" ignore="1"/>
If not, maybe the code below will work if the "auth-redirect" block you want to remove is nested into the "formkey" block.
<reference name="formkey">
<action method="unsetChild"><name>auth-redirect</name></action>
</reference>
I'm trying to use Magento for my shopping cart and want to switch from a right col layout to left col. I've turned on ID/CLASS display on the Web Developer Toolbar in firefox, and am seeing ".main col2-right-layout", which i believe i must switch to ".main col2-left-layout", the alternate style is predefined. but running searches for files with the phrase "col2-right-layout" in them is only pulling up the style sheet. I am searching THE ENTIRE Magento directory. How is this possible? Not case sensitive, and I'm even searching hidden folders. How can it be?
**i have looked in that file, the div is not mentioned. **
Files are in app/layout/default/default/templates/page/
I've not got a dev copy of magento at home, thats all I can remember off the top of my head - will try and remember to confirm when at work.
If you want to swap the templates, you need to look in app/layout/default/default/layout/page.xml, plus some of the other xml files - the templates are defined there.
(Yes, magento's layout/templating system is complicated, and has a steep learning curve, but its worth it!)
col2-right-layout is mentioned in
app/design/frontend/base/default/template/page/2columns-right.phtml
or in Magento 1.3
app/design/frontend/default/default/template/page/2columns-right.phtml
If you want to swap the layout I'd suggest changing it in one of the layout xml files. For the shopping cart edit app/design/frontend/base/default/layout/checkout.xml
change
<checkout_cart_index translate="label">
<label>Shopping Cart</label>
<remove name="right"/>
<remove name="left"/>
<!-- Mage_Checkout -->
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
to
<checkout_cart_index translate="label">
<label>Shopping Cart</label>
<remove name="right"/>
<remove name="left"/>
<!-- Mage_Checkout -->
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
And similarly for the checkout page in the same file change
<checkout_onepage_index translate="label">
<label>One Page Checkout</label>
<!-- Mage_Checkout -->
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
</reference>
to
<checkout_onepage_index translate="label">
<label>One Page Checkout</label>
<!-- Mage_Checkout -->
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
As always it is better to make a copy of the file you are editing to your own theme.