How you can add jQuery tabs in Magento CMS page

Тема в разделе "Magento", создана пользователем GoMage, 11 фев 2014.

  1. GoMage


    8 янв 2014
    We would like to highlight some moments as to adding jQuery tabs in Magento CMS pages. You can use jQuery tabs if you want to do it and you can find some examples and source code here:

    Let’s investigate a step-by-step instruction:

    At the beginning you should create a CMS page (CMS -> Pages -> Add New Page). Name the CMS page title as ‘Testing’.
    We have set the ‘Layout’ to ’1 column’ under ‘Design’ tab. But it is up to you.
    You should write the following sample code under ‘Content’ tab:

    <div style="float: right; width: 200px;">
    <p>{{block type="tag/popular" template="tag/popular.phtml"}}</p>
    <div id="tabs" style="width: 680px;">
    <li><a href="#tabs-1">Nunc tincidunt</a></li>
    <li><a href="#tabs-2">Proin dolor</a></li>
    <li><a href="#tabs-3">Aenean lacinia</a></li>
    <div id="tabs-1">
    <p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu.</p>
    <div id="tabs-2">
    <p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc.</p>
    <div id="tabs-3">
    <p>Mauris eleifend est et turpis. Duis id erat.</p>
    <p>Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna.</p>
    Please, save the page;

    In order to include the jQuery CSS and JS files you should add the following code in app/design/frontend/your_package/your_theme/template/page/html/head.phtml. IF condition can be used to include the jQuery CSS and JS page only on this particular CMS page only:

    $headBlock = $this->getLayout()->getBlock('head');
    if ($headBlock->getModuleName() == 'Mage_Page' && $headBlock->getTitle() =='Testing'): // remember from above step # 1 that the page title is set as 'Testing'
    <link rel="stylesheet"href="" />
    <script src=""></script>
    <script src=""></script>
    <script type="text/javascript">jQuery.noConflict();</script>
    <script type="text/javascript">
    jQuery(function() {
    jQuery( "#tabs" ).tabs();
    <?php endif; ?>
    Congratulations! You have created a new CMS page and you can view tabs on it. We have set the URL key for our new page as ‘testing’, then our new page URL will be or it will be on a local machine. You can check the tabs there.

    Also, we can recommend you to use some third party extensions, which work also on CMS pages such as GoMage Advanced Navigation extension. It helps to output the products and the navigation on the static pages. Also, you can add an infinite scroll using GoMage Advanced Navigation extension.

    It will help you to save your customers’ time when they search for a necessary product.

    Also, you can apply the process of adding a product to cart on the CMS pages by using GoMage ProCart extension. If you output the products and navigation using Advanced Navigation extension, you can provide customers with the opportunity to add a product to cart directly from CMS pages. It is a wonderful feature taking into account that GoMage ProCart extension uses Ajax technology which doesn’t need the page re-loading.

    “The code has been taken from the site
  2. tmp2000


    17 июн 2015
    it's great .While Hardcodes is not recommend.