WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Make sidebar show in archive-product.php search results? (9 posts)

  1. meadows.pete
    Member
    Posted 1 year ago #

    Hi,

    I'm working my way through a problem and if I can overcome this I'm done!

    I've added taxonomy-product_cat.php to my theme folder and changed the name to taxonomy-pa_myattributetitle.php so that the taxonomy search results are themed properly, but the results page is missing the sidebar.

    taxonomy-pa_myattributetitle.php is calling the archive-product.php template, should I make it call another template or do I need to do something to archive-product.php itself?

    Here's the search results page/string on the site : http://digitalmeadows.co.uk/londonbb/?pa_room-type=double&pa_location=&pa_price-band=&pa_amenities=

    I'd love for this to look like the normal shop page like this : http://digitalmeadows.co.uk/londonbb/?post_type=product

    Any ideas? Reward offered ;D

    Thanks

    Pete

    http://wordpress.org/extend/plugins/woocommerce/

  2. meadows.pete
    Member
    Posted 1 year ago #

    Or do I have to get another theme/woocommerce template and call that archive-product.php and then upload to the theme folder? If so, which one?

    Anyone? ;D

  3. jayseventwo
    Member
    Posted 1 year ago #

    Hi mate, sorry i cannot help you with your problem but i had a quick look at your page and your filtered search is exactly what i am after? Is this what you are talking about by placing taxonomy-product_cat.php in your theme folder, or if not could you please explain how you achieved this?

    Thanks a lot!

  4. meadows.pete
    Member
    Posted 1 year ago #

    Hey - I should have updated this thread already, I worked it all out today :) Let me explain what's going on as best I can (apologies in advance for the long read but hopefully it'll help).

    I'm using the Modernize theme from Goodlayers which isn't Woocommerce compatible out of the box, so I had to make a few changes. One of these was to create a new template called woocommerce.php which contained code from my theme's page.php template, adjusted here and there. Someone else had done the hard work for me here already and this made most of the pages work with Woocommerce OK.

    However, my current filtering is done using the Query Multiple Taxonomies plugin. The sidebar widget allows me to query the Product Attributes from Woocommerce automatically which is really nice, but I found the search results pages were all messed up and I was struggling with how to get them looking right. URL strings that worked from product cats were fine, product attributes not so.

    I then read on another thread somewhere that I needed to take a copy of the taxonomy-product_cat.php file, rename it to match the new attribute(s) like this 'taxonomy-pa_myattributenamehere.php' and then add it to my theme folder.

    However, the original taxonomy-product_cat.php file just contained code that called 'product-archive.php' and at first, I didn't know any different/better so used that same code in my new templates but it didn't work. I realised that it needed to be calling another template, or containing different code, but I wasn't sure what or how.

    Today I worked out that these new taxonomy-pa_attributenamehere.php templates actually needed the same code as that I created for the woocommerce.php file, as this is the code that allows my theme to play nicely with Woocommerce. So today I just copied the code from my woocommerce.php template I created for my theme into these new taxonomy templates, which then went into the root of my theme folder alongside woocommerce.php.

    Job done! Now I have a 3rd party theme, tightly integrated with woocommerce and some nice filtering to boot. Happy days. It's fairly close to Woo's Layered Nav widget, with the added bonus of working site wide, not just the Shop page etc.

    Does that help? I can dig out some extra links if you need it.

  5. jayseventwo
    Member
    Posted 1 year ago #

    Hi mate, that certainly sheds some light on things! I too have a custom theme and have done the woocommerce.php addition etc and all works fine there - my actual issue is that your site shows 3 or 4 drop downs, whereas mine is only showing the one. I am currently using product categories and thought my sub-cats would show up automatically in another drop down, which does not seem to be the case.

    Could you give me a simple example of how you set up your product attributes and i'll see if that works instead. I've not set up product attributes before and the one i did set up doesn't show up in the widget (there wasn't an option for attributes in the widget check boxes).

    Thanks again, and sorry for the dumb questions, haha!

  6. meadows.pete
    Member
    Posted 1 year ago #

    Haha no worries, I'm usually the one asking them! See the original post!

    First of all, create your attributes via Products > Attributes.

    To use the example of my site above, I've used attributes to categorise the rooms available by location, type, price etc, so I created a new attribute called Rooms (making sure Type is "select" not "text").

    Then I configured the terms for that attribute. In the case of Rooms the terms are single, double, twin, triple.

    Now, when I'm on the product page, I just add the attributes to each product. In the Product Data area, click the Attributes tab, click the blue Add button, select the attribute type from the dropdown list, then just click into the box and select the terms from the dropdown that will appear. That's it - just update and you're done.

    From here you can follow the rest of my instructions above and you should be able to recreate the rest of the steps to get it all sorted.

    You can also enable the attributes to show on the product pages, they will appear as a list in another tab that appears, and you can also set them as variations which are priced differently - i.e each room has a different cost.

    The method I've used also does away with Product Categories entirely - the main navigation menu is set up with custom URLs that also query attributes, so no need to use one style of navigation one place and another in the other.

  7. meadows.pete
    Member
    Posted 1 year ago #

    "...select from dropdown THEN blue Add button" - opps! You'll see what I mean.

  8. jayseventwo
    Member
    Posted 1 year ago #

    Awesome, that makes sense, thanks! I had actually started to figure it when you replied, haha - i am coming from a jigoshop background and everything is just a little bit different.

    A question regarding your custom menus - I had thought of that too, but i'm guessing the way you've set it up is not really ideal for the average client who wants to quickly add a menu item, such as it is now in WordPress/Woo? Would you be able to provide a quick example of that also, just so i can see how your attribute query works?? :)

    Thanks a gain dude - I've been banging my head over this for days!

  9. meadows.pete
    Member
    Posted 1 year ago #

    I know that feeling!

    It's not ideal in terms of the menu, but the search string is easy enough and it's only couple of extra clicks. If the client is savvy enough to run a store they should grasp it OK I reckon. It's better than having them create attributes for the fancy widget but fill in categories too for everything else. Better to standardise I thought.

    Anyway...

    mywebsite.com/?pa_room-type=double

    ?pa_ is what woo uses for attribute queries, room-type is the attribute name, equals the attribute term.

    I created a new menu using attributes so if I ever wanted to revert the old categories based one was still there but now it's sorted I doubt we'll go back.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic