FacetWP + ACF = Exclude product if not manufactured anymore - php

For the last few days I have been wrapping my head around this but for the life of me, can't figure out a way to do this.
I have a WordPress website dedicated to different categories of products. I use Custom Post Type UI to create the product categories, ACF for custom fields for each product type and then FacetWP for the indexing and filtering part. Each category has a dedicated catalogue style page where I have certain filters from FacetWP for users to narrow down their search for a product that fits their requirements.
Everything is working well, however, my issue is that some products get discontinued and are being replaced by newer versions. Because of this, I have added a custom field for each category such as "wm_manufactured" (washing machines) that has a simple check box with "Yes". If the checkbox is ticked, then I want the product to be displayed in the catalogue.
Does anyone know how to skip products or remove them from indexing if a certain field is empty or maybe another way of doing this?
I need these product pages to still be available through a direct link because they are being ranked high on Google and I have a banner informing customers that this particular product has been discontinued and have a link to its replacement.

So I found the answer to my trouble and it was right in front of me.
When making a "Listing" template in FacetWP, there is a second tab called Query.
When I was testing the query filters, I was only putting the value that I set up on ACF, but the actual value that I had to add for the system to compare to was the exact figure from inside the database.
While ACF would have returned a "yes" for example, FacetWP was only seeing
a : 1 : { i : 0; s : 3 : "yes"; }
the value present in the database. So check the database for the exact value and don't just go based on what ACF will return.

Related

woocommerce wordpress: sorting product trick

I'm working on a woocommerce site, and i'm facing a problem.
I'm updating the products, the products are sorted alphabetically, but all the new products in theyr name have a prefix, like this they're all showed in the 5th page.
I wanted to ask if there was a way to tell woocommerce to keep the alphabetical oreder but without counting the prefix
Thanks
I don't think it is directly possible. There is a workaround though:
Create a custom (post meta) field associated with the "product" post type (e.g abc_title)
Replicate the product title (without prefix) in it, on the product save hook
Use pre_get_posts action on the product page and update the sortorder field (abc_title)
For already added posts, you can write a script to replicate product titles.
Bingo!

bootstrap how to add/remove category just like opencart?

Recently, I working on a PHP project that comes with product and product category. Each product can assign to multiple categories.
Product name, quantity all these are quite easy to handle as they are input text box. But for category, its a bit complicated. So i use checkboxes to handle category selection. It works fine for inserting mysql as i simply use foreach loop to check which checkbox has clicked. To update/del by using array_diff to check the new selected checkbox or unselected.
Then I found out that opencart handle category in this way
1 input box for user to key in category name with auto suggestion, when clicking on the suggested name, it will be added. so to remove it, just click on the minus sign button. Its simply and straight forward.
So I am wondering is there a way to do something like that by using bootstrap design? OR is there some opensource for such function ?

Magento Attribute Sort Order in Configurable Product

I need help with the following:
In Magento I have created a configurable product and assigned some simple products to it. They have an individual attribute set with individual, numeric attributes that I have created.
One attribute is for example "length". This attribute has the following values:
3,4,5,6,7,8,9,10,12,14,16,18,20
If I open the drop-down menu on the article details page, the values get displayed like that:
10,12,14,16,18,20,3,4,5,6,7,8,9
Thus, it seems that the attributes are saved as text (alphanumerical?) and not as numbers (numerical)?!
I need some advice on how I can change that. I have tried to work with "Input Validation for Store Owner" in "Manage Attributes", but that doesn't work. Is there f.e. any field in my database where I can simply switch the way my attributes are saved/displayed?
I have created many products and attributes, thus I don't want to re-create all of them again, if not necessary.
Thanks for any reply.
It has been a long time since you asked and might be you have already found a solution to it. I am just writing so that anyone coming on this page for the same problem does not have to go thru the same pain what i went thru.
When you create the attribute(length), you would have created the options (like 3/4/5.. etc) create the sort of that options in the attribute section and they will sort as per your requirement.

Show price layered navigation after selecting price filter

I would like to show price filter option after selecting price filter already. So, I would like to keep all price filters, even if price filter is already selected. Is this possible?
magento uses the layered navigation system where when u filter a category with something say price, all the other possible selection in the price disappears in that filter, so if you want to pick another price range, you have to go back to the previous page or deselect the filter.
I did this using php sessions and writing a custom functionality to filter.phtml. I set sessions with filter name which includes url and title, and wrote if session is set, then write it. So I literally manually created all links, when one filter is selected. Hope this will help someone..
This answer links to a popular Free module which accomplishes what you are after and has been updated to the latest version of CE;
How to make Magento not hide layered navigation filters?
Here is the link;
https://www.magentocommerce.com/magento-connect/multiple-select-in-layered-navigation-filters.html

Search by SKU but show Grouped Products that have that SKU associated

I need my quick search to search by SKU. I know that's the way Magento works by default but unfortunately that's only for simple products (I think).
In my case, I have a store that uses simple products set to "not visible individually", and then I have grouped products that associate those simple products. Only the simple products have the SKU attribute but they're only shown when you open the grouped product.
What I need then, is to have it search inside those grouped products for the simple products with the SKU entered in the quick search field, and then display the grouped products that have a match.
Is there anything that does this? Seems to me it should be baseline in Magento.
Edit: Magento 1.4.2
Working on this issue right now. The solution I'm thinking of trying is suggested here:
http://www.magentocommerce.com/boards/viewthread/74229/
The idea is to set the simple product visible in search instead of not individually visible. Then in the product template check if the simple product is part of a group. If so JavaScript redirect to the grouped product page.
Still thinking about a cleaner solution but thought this might be of some help.
Not sure if people are still looking for answers to this, but i was so I'll post my resolution anyway :)
Simply add all the SKU's with a space onto the SKU of the grouped product. Then when someone searches for one of them, it will bring up your grouped product. Then you need to do nothing to the simple products at all, they can remain hidden. Also works for configurable items.
Hope I help someone!
IP

Categories