Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Add Categories Dropdown To Search Box Rate Topic   * * * * * 1 votes

 
  • mokeshop
  • Senior Member
  • Members
  • Join Date: 27-Jul 12
  • 922 posts

Posted 21 January 2016 - 01:08 PM #1

hello,

 

anyone have a clue how to start or have an idea how to make this.

 

such idea was in the old version 2x version of cs cart....

 

 

regards

džemal



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17999 posts

Posted 21 January 2016 - 02:47 PM #2

Try to create the following file:

 

/design/themes/YOUR_THEME/templates/addons/my_changes/hooks/search/additional_fields.pre.tpl

 

with this content:

<div class="ty-float-left">{* dont delete this div. its really needed! *}
        {assign var="all_categories" value=0|fn_get_plain_categories_tree:false}
        <select name="cid">
            <option value="0" {if $category_data.parent_id == "0"}selected{/if}>- {__("all_categories")} -</option>
            {foreach from=$all_categories item="cat"}
            <option value="{$cat.category_id}" {if $cat.disabled}disabled="disabled"{/if}{if $search.cid == $cat.category_id} selected="selected"{/if} title="{$cat.category}">{$cat.category|escape|truncate:50:"...":true|indent:$cat.level:"&#166;&nbsp;&nbsp;&nbsp;&nbsp;":"&#166;--&nbsp;" nofilter}</option>
            {/foreach}
        </select>
    </div>

Note:

- the My changes module should be activated

- cache should be cleared

- additional CSS changes may be required


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • mokeshop
  • Senior Member
  • Members
  • Join Date: 27-Jul 12
  • 922 posts

Posted 21 January 2016 - 06:41 PM #3

Try to create the following file:

 

/design/themes/YOUR_THEME/templates/addons/my_changes/hooks/search/additional_fields.pre.tpl

 

with this content:

<div class="ty-float-left">{* dont delete this div. its really needed! *}
        {assign var="all_categories" value=0|fn_get_plain_categories_tree:false}
        <select name="cid">
            <option value="0" {if $category_data.parent_id == "0"}selected{/if}>- {__("all_categories")} -</option>
            {foreach from=$all_categories item="cat"}
            <option value="{$cat.category_id}" {if $cat.disabled}disabled="disabled"{/if}{if $search.cid == $cat.category_id} selected="selected"{/if} title="{$cat.category}">{$cat.category|escape|truncate:50:"...":true|indent:$cat.level:"&#166;&nbsp;&nbsp;&nbsp;&nbsp;":"&#166;--&nbsp;" nofilter}</option>
            {/foreach}
        </select>
    </div>

Note:

- the My changes module should be activated

- cache should be cleared

- additional CSS changes may be required

 

thank you for quick response.

 

have tried as instructed above and it's not showing on 4.3.5. 

 

maybee some css is needed to get it positioned properly



 
  • mokeshop
  • Senior Member
  • Members
  • Join Date: 27-Jul 12
  • 922 posts

Posted 02 February 2016 - 12:41 PM #4

Stucked.hope someone has used similar solution

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17999 posts

Posted 02 February 2016 - 03:47 PM #5

thank you for quick response.

 

have tried as instructed above and it's not showing on 4.3.5. 

 

maybee some css is needed to get it positioned properly

 

Works for me:

 

http://prntscr.com/9y3j5b


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • mokeshop
  • Senior Member
  • Members
  • Join Date: 27-Jul 12
  • 922 posts

Posted 02 February 2016 - 04:23 PM #6

Hm... i was using chrome will check other browsers or try to m8ve it somewhere visible

 
  • mokeshop
  • Senior Member
  • Members
  • Join Date: 27-Jul 12
  • 922 posts

Posted 04 February 2016 - 07:44 PM #7

Works for me:

 

http://prntscr.com/9y3j5b

 

yes. you're right. i had a mistype error. got it showing.

 

thank you



 
  • mokeshop
  • Senior Member
  • Members
  • Join Date: 27-Jul 12
  • 922 posts

Posted 04 February 2016 - 09:13 PM #8

playing currently with css

 

https://drive.google...ew?usp=drivesdk

 

I have replaced the ty-float-left with <div class="top-search-categories">



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17999 posts

Posted 05 February 2016 - 09:12 AM #9

Thank you for sharing this information


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • Poseidonas
  • Advanced Member
  • Trial users
  • Join Date: 01-Feb 16
  • 51 posts

Posted 08 February 2016 - 01:13 PM #10

If I want to place the 'Brands' in that dropdown? Exist the odd to do that? :)



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17999 posts

Posted 08 February 2016 - 03:23 PM #11

We failed to find such a module in the marketplace. Additional code modifications are requried


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • nonu_don
  • Junior Member
  • Members
  • Join Date: 14-May 11
  • 83 posts

Posted 12 September 2016 - 09:11 AM #12

playing currently with css

 

https://drive.google...ew?usp=drivesdk

 

I have replaced the ty-float-left with <div class="top-search-categories">

i am trying to get the category drop down in line as the search bar (as in your pic) but i am not able to. can you please guide how you achieved this.



 
  • CartBooster
  • Senior Member
  • Members
  • Join Date: 25-Jun 06
  • 238 posts

Posted 02 August 2017 - 01:00 AM #13

Hi,

 

This works for me,

 

However the the results page doesn't update accordingly,

 

Any ideas? 4.1.5

 

Stephen


www.cartbooster.ie


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17999 posts

Posted 02 August 2017 - 04:39 AM #14

Hi,

 

This works for me,

 

However the the results page doesn't update accordingly,

 

Any ideas? 4.1.5

 

Stephen

 

Please share or PM me URL of your website


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • CartBooster
  • Senior Member
  • Members
  • Join Date: 25-Jun 06
  • 238 posts

Posted 08 October 2017 - 04:49 PM #15

Just to add, we figured the issue we were having, it was the "Live Search" addon from Cart Power - it doesnt take the parameter of catagory when the pages are cached, disabling this addon fixes this, have informed the developer of my findings...


www.cartbooster.ie


 
  • harsh
  • Member
  • Trial users
  • Join Date: 22-Sep 17
  • 16 posts

Posted 03 September 2018 - 08:57 AM #16

Try to create the following file:

 

/design/themes/YOUR_THEME/templates/addons/my_changes/hooks/search/additional_fields.pre.tpl

 

with this content:

<div class="ty-float-left">{* dont delete this div. its really needed! *}
        {assign var="all_categories" value=0|fn_get_plain_categories_tree:false}
        <select name="cid">
            <option value="0" {if $category_data.parent_id == "0"}selected{/if}>- {__("all_categories")} -</option>
            {foreach from=$all_categories item="cat"}
            <option value="{$cat.category_id}" {if $cat.disabled}disabled="disabled"{/if}{if $search.cid == $cat.category_id} selected="selected"{/if} title="{$cat.category}">{$cat.category|escape|truncate:50:"...":true|indent:$cat.level:"&#166;&nbsp;&nbsp;&nbsp;&nbsp;":"&#166;--&nbsp;" nofilter}</option>
            {/foreach}
        </select>
    </div>

Note:

- the My changes module should be activated

- cache should be cleared

- additional CSS changes may be required

Hello,

 

It also worked for me 

but i want only  first level categories to show

don't know how ... :(

i have tried to play with the code but it was not worth

Please suggest me with the solution 

 

Thanks in advance



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17999 posts

Posted 03 September 2018 - 01:11 PM #17

Please try

<div class="ty-float-left">{* dont delete this div. its really needed! *}
        {assign var="all_categories" value=0|fn_get_plain_categories_tree:false}
        <select name="cid">
            <option value="0" {if $category_data.parent_id == "0"}selected{/if}>- {__("all_categories")} -</option>
            {foreach from=$all_categories item="cat"}
            {if $cat.level == 1}
            <option value="{$cat.category_id}" {if $cat.disabled}disabled="disabled"{/if}{if $search.cid == $cat.category_id} selected="selected"{/if} title="{$cat.category}">{$cat.category|escape|truncate:50:"...":true|indent:$cat.level:"&#166;&nbsp;&nbsp;&nbsp;&nbsp;":"&#166;--&nbsp;" nofilter}</option>
            {/if}
            {/foreach}
        </select>
    </div>

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.