Cs-cart category menu descriptions - cs-cart

I am trying to show category description in category menu. Under each category link i would like to display a short description that is added through admin when creating the category.
This is the code in the tpl that displays the category menu:
{hook name="blocks:sidebox_dropdown"}{strip}
{assign var="foreach_name" value="item_`$iid`"}
{foreach from=$items item="item" name=$foreach_name}
{hook name="blocks:sidebox_dropdown_element"}
<li class="{if $separated && !$smarty.foreach.$foreach_name.last}b-border {/if}{if $item.$childs}dir{/if}{if $item.active || $item|fn_check_is_active_menu_item:$block.type} cm-active{/if}">
{if $item.$childs}
{hook name="blocks:sidebox_dropdown_childs"}
<div class="hide-border"> </div>
<ul>
{include file="blocks/sidebox_dropdown_chiled.tpl" items=$item.$childs separated=true submenu=true iid=$item.$item_id}
</ul>
{/hook}
{/if}
{assign var="item_url" value=$item|fn_form_dropdown_object_link:$block.type}
<a{if $item_url} href="{$item_url}"{/if} {if $item.new_window}target="_blank"{/if} class="my_main_navlinks">{$item.$name}</a>
</li>
{/hook}
{/foreach}
{/strip}{/hook}

It is not a right way to change the sidebox_dropdown.tpl file, because this file is used everywhere.
The right way is to create a new block template for categories.
Open this folder: /design/themes/[YOUR_SKIN]/templates/blocks/categories/
You will find (basically) 4 files:
categories_dropdown_horizontal.tpl
categories_dropdown_vertical.tpl
categories_multicolumn_list.tpl
categories_text_links.tpl
Create a new one and add any code you need. Put the sidebox_dropdown.tpl code inside your new file too.
After that just open Admin area -> Design -> Layouts. Open properties of the categories block and select your new file.

Related

CS Cart - Show Three Level of Categories on Catalog and Top Category Page

For CS-Cart Multivendor, Version 4.15.2
How can we display 6 Sub-Categories-Level-1 and 3 Sub-Categories-Level-2 on mydomain.com/catalog page, similar to https://my.indiamart.com/ or https://dir.indiamart.com/
Then how to display 5 Sub-Categories-Level-1 image and name as displayed on https://dir.indiamart.com/
How can we display All Sub-Categories-Level-1 and 5 SubCategories-Level-2 on individual Category Page like below along with Level-1 and Level-2 Images
https://dir.indiamart.com/industry/builders-hardware.html
Finally Display SubCatetory-Level-2 and All Sub-Category-Level3 like
enter link description here
I think there is some modification required in views\categories\catalog.tpl and categories\components\subcategories.tpl.
Also some HTML and css related help is highly appreciated for user friendly view on all devices.
Thanks.
categories_multicolumns.tpl
{split data=$categories size=$columns|default:"3" assign="splitted_categories"}
{strip}
{foreach from=$splitted_categories item="scats"}
{foreach from=$scats item="category"}
{if $category}
{$href=$category|fn_form_dropdown_object_link:$block.type}
{if $category.main_pair}
{include file="common/image.tpl"
show_detailed_link=false
images=$category.main_pair
no_ids=true
image_id="category_image"
image_width=$settings.Thumbnails.category_lists_thumbnail_width
image_height=$settings.Thumbnails.category_lists_thumbnail_height
class="ty-subcategories-img"
}
{/if}
{$category.category}
{/if}
{/foreach}
{/foreach}
{/strip}
{capture name="mainbox_title"}{$title}{/capture}
subcategories.tpl
{if $subcategories}
{math equation="ceil(n/c)" assign="rows" n=$subcategories|count c=$columns|default:"3"}
{split data=$subcategories size=$rows assign="splitted_subcategories"}
<ul class="subcategories clearfix">
{hook name="categories:view_subcategories"}
{foreach from=$splitted_subcategories item="ssubcateg"}
{foreach from=$ssubcateg item=category name="ssubcateg"}
{if $category}
<li class="ty-subcategories__item">
<a href="{"categories.view?category_id=`$category.category_id`"|fn_url}">
{if $category.main_pair}
{include file="common/image.tpl"
show_detailed_link=false
images=$category.main_pair
no_ids=true
image_id="category_image"
image_width=$settings.Thumbnails.category_lists_thumbnail_width
image_height=$settings.Thumbnails.category_lists_thumbnail_height
class="ty-subcategories-img"
}
{/if}
<span {live_edit name="category:category:{$category.category_id}"}>{$category.category}</span>
</a>
</li>
{/if}
{/foreach}
{/foreach}
{/hook}
</ul>
{/if}

How to mark only product categories?

How do I have to mark my website product categories? … only categories …
Maybe with category from Offer?
Something like:
<div itemscope itemtype="http://schema.org/Offer">
<a itemprop="category" href="category1.php">My category 1</a>
</div>
You should not specify category on an a element. The value would be the URI (category1.php), not the content (My category 1).
category expects a value that is either text or another item.
So if you want to provide text, you could use something like:
<div itemscope itemtype="http://schema.org/Offer">
<span itemprop="category">My category 1</span>
</div>
And yes, it is totally fine to use only one property. Schema.org doesn’t define required properties. But consumers (e.g., search engines) might, of course, only consider re-using your data if it fulfils certain of their own requirements.
UPDATE: If you want to provide several categories for the item, it could be something like:
<div itemscope itemtype="http://schema.org/Offer">
<ul>
<li itemprop="category">My category 1</li>
<li itemprop="category">My category 2</li>
<li itemprop="category">My category 3</li>
</ul>
</div>
Don’t rename the category property! Adding 1, 2 etc. to it would be wrong.
(And it it’s a hierarchy of categories, you could use one value and / or >., e.g. Sports > Tennis.)

Linking to waypoint from external page

So i'm using the jQuery waypoints plugin for the navigation of a single page site
Right now it looks like this:
<div class="navigation">
<ul id="navi">
<li data-slide="1">DC3</li>
<li data-slide="2">THE ABOUT</li>
<li data-slide="3">THE WORK</li>
<li data-slide="4">THE CLIENTS</li>
<li data-slide="5">THE WHO</li>
<li data-slide="6">CONTACT</li>
</ul>
and each data-slide moves to a separate div like this:
<div class="slide" id="slide1" data-slide="1" data-stellar-background-ratio=".5">
What I want to do is use the same navigation on a second page, that will target each data-slide div on teh original page. Is there a way to do this?
A very simple solution is to used named anchors. In the HTML, next to each element you want to target add a new anchor element like <a id="slide"></a> and then you can link to that anchor's position on the page by using a fragment in your URL like so example.html#slide.

How can I select the 6th option in the list?

<div id="suggestionlist">
<ol id="suggestionroot">
<li id="sugg_1">
<li id="sugg_2">
<li id="sugg_3">
<li id="sugg_4">
<li id="sugg_5">
<li id="sugg_6">
<li id="sugg_7">
<li id="sugg_8">
<li id="sugg_9">
<li id="sugg_10">
I have a search look ahead feature which I'm trying to automate. I'm trying to pick the 6th option in the list every time but I just can't seem to locate it! This is the nearest I've got but it's not working..
#Browser.div(:id, "suggestionlist").link(:index, 6).click
You should do some reading about HTML. <li> tag is not link, <a> tag is link.
So, to click <li id="sugg_6"> try this:
browser.li(:id => "sugg_6").click
To click a link inside the list item (not shown in your HTML but referenced in comments)
browser.li(:id => "sugg_6").link.click
(that presumes you want to click the first/only link inside the LI, otherwise you might need to specify an index value)
Did you try to access this element by XPath?
browser.find_elements_by_xpath("div[#id='suggestionlist'/li[6]").click

Smarty Templates - Multiple Classes

Here is my template code:
<li class="{$product.name}" {if $product.name == $filter_product.name}class=active{/if}">
I want to be able to set the $product.name as the class, and when the $product.name is the active filter also add the class "active"
You can only have one class attribute, but it can contain more than one class - separate them using a space. So in your example:
<li class="{$product.name}{if $product.name == $filter_product.name} active{/if}">
Found the answer myself:
{if $product.name == $filter_product.name}
<li class="active {$product.name}">
{else}
<li class="{$product.name}">
{/if}

Resources