Datafeedr Support Forums

Datafeedr Support Forums (/index.php)
-   Problems (/forumdisplay.php?f=68)
-   -   Couple of minor fixes (/showthread.php?t=3535)

badm00n January 8th, 2011 05:04 PM

Couple of minor fixes
 
Hello, v3 upgrade went well. Now just trying to match the visuals that i had in my v1 store.

1. Category Widget Style.

I believe the currently selected category would get an li class="active" style. I tried to add this to the new category widget settings but i couldn't get it to work properly.

2. Store search replacing default wordpress search.

The custom code to replace the default search no longer works in v3. Do you have the new code for this?


Thanks.

Eric January 8th, 2011 05:18 PM

Hi

1. I changed the default category widget style to add the class="active" css to the li element. You can either edit yours or simply go to Factory > Views > Widgets > Categories > View Menu > Reset this view. That will delete any changes you made but add the class active stuff. Or just make the changes yourself like this:



2. Are you editing your theme's template files?

Eric

badm00n January 8th, 2011 05:32 PM

Thanks for #1. Any idea how I would now a class to the 2nd <ul> only? I had <ul class="level2"> for any child categories.

The search box I just had added code to my header. Sorry I deleted some of the code because it was giving me an error but this is what I still have left.

<form method="post" action="">
<div class="search">
<input type="text" onfocus="if(this.value=='search...') this.value='';" onblur="if(this.value=='') this.value='search...';" value="search..." size="20" class="inputbox" alt="Search" maxlength="20" id="mod_search_searchword" name="dfrs"><input type="image" onclick="this.form.searchword.focus();" src="<?php bloginfo('template_directory'); ?>/images/searchButton.gif" class="button" value="Search"> </div>
<input type="hidden" value="<?php echo get_option('dfr_page_for_store'); ?>" name="page_id" />

There was a php if statement and a php code in the action that was rendering the error so I removed it.

badm00n January 8th, 2011 05:43 PM

Sorry that last part probably wasn't clear. Here is the code from this thread i was using?

/showthread.php?t=697

Eric January 8th, 2011 06:16 PM

Hi

Quote:

Originally Posted by badm00n (Post 16194)
Thanks for #1. Any idea how I would now a class to the 2nd <ul> only? I had <ul class="level2"> for any child categories.

So, the fun begins... nested categories.

They are a little tricky to implement and even harder to explain but basically you can define a format of HTML for every level in your category list. You do this by assigning id's to category lists.

Here's the code that accomplishes what you are intending to do:

Code:

[category.list before='<ul>' after='</ul>']
   
  [category.if active="self"]
    <li class="active">
      <a href="[category.link]" title="[category.name]">[category.name]</a>
      [category.list id='dfchild' before='<ul class="level2">' after='</ul>']
        <li>
          <a href="[category.link]" title="[category.name]">[category.name]</a>
        </li>
        [category.repeat id='dfchild']
      [/category.list]
    </li>
  [/category.if]
 
  [category.if active="child"]
    <li>
      <a href="[category.link]" title="[category.name]">[category.name]</a>
      [category.list id='dfchild' before='<ul class="level2">' after='</ul>']
        <li>
          <a href="[category.link]" title="[category.name]">[category.name]</a>
        </li>
        [category.repeat id='dfchild']
      [/category.list]
    </li>
  [/category.if]
 
  [category.if active="parent"]
    <li>
      <a href="[category.link]" title="[category.name]">[category.name]</a> 
    </li>
  [/category.if]
 
  [category.if active="no"]
    <li>
      <a href="[category.link]" title="[category.name]">[category.name]</a>
    </li>
  [/category.if]
 
[/category.list]​

Eric

Eric January 8th, 2011 06:17 PM

Quote:

Originally Posted by badm00n (Post 16195)
Sorry that last part probably wasn't clear. Here is the code from this thread i was using?

/showthread.php?t=697

I'm working on this. I think there is a bug that needs to get worked out before I can give you the code for that.

Eric

Eric January 8th, 2011 06:27 PM

Quote:

Originally Posted by badm00n (Post 16195)
Sorry that last part probably wasn't clear. Here is the code from this thread i was using?

/showthread.php?t=697

OK, here's one method. I might post a simpler solution if I can work that out:
  1. Log into the Factory
  2. Go to Views > Custom Views > Add a new view
  3. Name the view "Search Form" and check the "Don't use layout for this view" checkbox
  4. Add a "text" widget to the module area.
  5. Click the template icon and add the code below (same code that can be found in your Widgets > Simple Search view):
    Code:

    <script type="text/javascript">
    <!--
    /*
     * NOTE: This JS code would be much better off
     * existing in your theme's header.php file.
    */
    function wash( anInput ) { if(anInput.value == anInput.defaultValue) anInput.value = ''; }
    function checkWash( anInput ) { if(anInput.value == '') anInput.value = anInput.defaultValue; }
    //-->
    </script>

    <div class="store_search_form">
      [search.form]
      [search.word onfocus='wash(this);' onblur='checkWash(this);' value='Search store...']
      [search.submit title='Go']
      [/search.form]
    </div>​

  6. Save the template code
  7. Update your store
  8. Paste the following code into your template files wherever you want the new search form to appear:
    Code:

    <?php echo datafeedr_tag("Search Form"); ?>

Eric

badm00n January 8th, 2011 07:08 PM

Thanks Eric. Both codes worked very nicely.

Just one small addition to the nested categories - The child li doesn't get an active class when selected.

Thanks.

Eric January 8th, 2011 08:25 PM

This ought to work:
Code:

[category.list before='<ul class="level<?php echo $depth; ?>">' after='</ul>']
   
  [category.if active='self']
    <li class="active">
      <a href="[category.link]" title="[category.name]">[category.name]</a>
      [category.repeat]
    </li>
  [/category.if]
 
  [category.if active='child']
    <li>
      <a href="[category.link]" title="[category.name]">[category.name]</a> 
      [category.repeat]
    </li>
  [/category.if]
 
  [category.if active='parent']
    <li>
      <a href="[category.link]" title="[category.name]">[category.name]</a> 
    </li>
  [/category.if]
 
  [category.if active='no']
    <li>
      <a href="[category.link]" title="[category.name]">[category.name]</a>
    </li>
  [/category.if]
   
[/category.list]​



All times are GMT -5. The time now is 12:58 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.