Genres to Categories Search

Dazed
Dazed
@dazed
11 years ago
1,022 posts
I am trying to basically duplicate the music.tpl to become a jrstore area instead. This way people can search for specific store items. I have removed the alphabetical search that was on the music page. I am in the process of changing the side Genre search to be a Category Search.

When I click on the Genre Tab I get this immediately, "The Product Update Was Successfully Saved. Search" and I am not sure why. It does not do this on the music page.

merchandise_categories.tpl (old music_genres.tpl)
<!-- Search Product Category-->
<h3>{jrCore_lang module="jrStore" id="12" default="Category"} {jrCore_lang skin=$_conf.jrCore_active_skin id="24" default="Search"}</h3>
<br />
<form class="margin" method="post" action="{$jamroom_url}/merchandise">
    <input type="hidden" name="search_area" value="product_category">
    <select class="form_select" name="search_string" style="width:100%; font-size:13px;" onchange="this.form.submit()">
        {if isset($_post.search_area) && $_post.search_area == 'product_category'}
            <option value="{$_post.search_string}">{$_post.search_string}</option>
        {else}
            <option value="">{jrCore_lang skin=$_conf.jrCore_active_skin id="168" default="Select A Category"}</option>
        {/if}
        {jrCore_list module="jrStore" order_by="product_category asc" group_by="product_category" limit="200" template="merchandise_category_row.tpl"}
    </select>
</form>


In the drop down I see my 2 test categories which is cool. If I click on 1 though, the row does not change to the specif Category I selected. If I click on the category drop down again, I have duplicates (I display 3 Paintings and One Picture Category in the drop down) listed but I only have 2 test categories.

Apologies for the long thread but this area is a bit complex as Douglas knows hehe.

merchandise.tpl (somewhat modified music.tpl)

{assign var="selected" value="merchandise"}
{assign var="no_inner_div" value="true"}
{if isset($_post.search_area) && $_post.search_area == 'product_category'}
    {jrCore_lang skin=$_conf.jrCore_active_skin id="56" default="merchandise" assign="page_title1"}
    {assign var="page_title" value="`$_post.search_string` `$page_title1`"}
{else}
    {jrCore_lang skin=$_conf.jrCore_active_skin id="56" default="merchandise" assign="page_title"}
{/if}
{jrCore_page_title title=$page_title}
{jrCore_include template="header.tpl"}
<script type="text/javascript">
    $(document).ready(function(){ldelim}
        jrSkinInit();
        {rdelim});
</script>

<div class="container">
    <div class="row">

        <div class="col3">
            <div class="body_1">
                {jrCore_include template="side_merchandise.tpl"}
            </div>
        </div>

        <div class="col9 last">

            <div class="body_1 mr5">

                <div class="container">
                    <div class="row">
                        <div class="col12 last">
                            <div class="body_3">{jrCore_module_url module="jrStore" assign="murl"}

    <div class="block_content">

        <div id="default_list">
            {jrCore_list module="jrStore" profile_id=$_items_profile_id order_by="product_display_order numerical_asc" pagebreak="15" page=$_post.p}
        </div>

    </div>

</div>





                            </div>
                        </div>
                    </div>
                </div>

            </div>

        </div>

    </div>
</div>

{jrCore_include template="footer.tpl"}


merchandise_category_row.tpl
{if isset($_items)}
    {jrCore_module_url module="jrStore" assign="murl"}
    {foreach from=$_items item="item"}
        <option value="{$item.product_category}">{$item.product_category}</option>
    {/foreach}
{/if}

side_merchandise.tpl

</table>
<div id="stats" class="body_3 mb20">
    {if isset($_post.search_area) && $_post.search_area == 'product_category'}
        <!-- Search Song Genre-->
        <h3>{jrCore_lang module="jrStore" id="12" default="Category"} {jrCore_lang skin=$_conf.jrCore_active_skin id="24" default="Search"}</h3>
        <br />
        
        <form class="margin" method="post" action="{$jamroom_url}/merchandise">
            <input type="hidden" name="search_area" value="product_category">
            <select class="form_select" name="search_string" style="width:100%; font-size:13px;" onchange="this.form.submit()">
                {if isset($_post.search_area) && $_post.search_area == 'product_category'}
                    <option value="{$_post.search_string}">{$_post.search_string}</option>
                {else}
                    <option value="">{jrCore_lang skin=$_conf.jrCore_active_skin id="168" default="Select A Category"}</option>
                {/if}
                {jrCore_list module="jrStore" order_by="product_category asc" group_by="product_category" limit="200" template="merchandise_category_row.tpl"}
            </select>
        </form>

updated by @dazed: 10/21/14 05:25:13AM
douglas
@douglas
11 years ago
2,797 posts
The only thing I see is the profile id in the merchandise.tpl is never going to have a value, since it is not inside a row template or foreach loop. If you are going to show merchandise from all users, you might want to take that out.

I've never seen the issue your having with the tab search and the code looks good to me. If I find some time today, I'll see if I can duplicate your issue.


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
douglas
@douglas
11 years ago
2,797 posts
Also, the jrCore_list function in your merchandise.tpl template is not searching for the categories... it should have a search parameter in there.

Quote:
{jrCore_list module="jrStore" order_by="product_display_order numerical_asc" search1="profile_category = `$_post.search_string`" pagebreak="15" page=$_post.p}



--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
Dazed
Dazed
@dazed
11 years ago
1,022 posts
Thanks Douglas. I made the change and the merchandise page goes blank. If I remove the below all the items appear. So I am guessing my category search is %$*@#!???
search1="profile_category = `$_post.search_string`"
brian
@brian
11 years ago
10,148 posts
Are you passing in a search_string on the URL?


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
douglas
@douglas
11 years ago
2,797 posts
Try changing your jrCore_list function to this:

{if isset($_post.search_area) &&  isset($_post.search_string)}
{jrCore_list module="jrStore" order_by="product_display_order numerical_asc" search1="profile_category = `$_post.search_string`" pagebreak="15" page=$_post.p} 
{else}
{jrCore_list module="jrStore" order_by="product_display_order numerical_asc" pagebreak="15" page=$_post.p} 
{if}

That is how the audio genre is setup so it should work as long as you have a product_category.

Hope this helps! :)


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
Dazed
Dazed
@dazed
11 years ago
1,022 posts
Thanks guys that is better. When I load the merchandise page it looks correct. The side category drop down is not returning any results though.

The side_merchandise.tpl calls the merchandise_category_row.tpl
merchandise_categories.tpl calls merchandise_category_row.tpl (added below and the rest are above) I played around with them a bit but no luck so I reverted back to what was posted here so it was easier.

Anything missing?

{if isset($_items)}
    {jrCore_module_url module="jrStore" assign="murl"}
    {foreach from=$_items item="item"}
        <option value="{$item.product_category}">{$item.product_category}</option>
    {/foreach}
{/if}
douglas
@douglas
11 years ago
2,797 posts
I'm assuming this isn't on mixposure, I looked for a product page and didn't see one, can you send me the URL and login info so I can take a look?

Thanks!


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos