So I'm adding products to my site from the admin panel. But i cant look up the products with the product code in the admin panel? I have to use a keyword. On my other site i can search the products by the product number in the search but not this one, why is that?
The search in the upper right-hand corner should allow you to search by product code, but to make it possible to search with the regular search on both the admin and the customer side do this:
In core/fn.catalog.php
Change:
if ($params['pname'] == 'Y') {
$tmp .= db_quote(" OR descr1.product LIKE ?l", "%$piece%");
}
if ($params['pshort'] == 'Y') {
$tmp .= db_quote(" OR descr1.short_description LIKE ?l", "%$piece%");
}
if ($params['pfull'] == 'Y') {
$tmp .= db_quote(" OR descr1.full_description LIKE ?l", "%$piece%");
}
if ($params['pkeywords'] == 'Y') {
$tmp .= db_quote(" OR (descr1.meta_keywords LIKE ?l OR descr1.meta_description LIKE ?l)", "%$piece%", "%$piece%");
}
if (!empty($params['feature']) && $params['action'] != 'feature_search') {
$tmp .= db_quote(" OR ?:product_features_values.value LIKE ?l", "%$piece%");
}
To:
if ($params['pname'] == 'Y') {
$tmp .= db_quote(" OR descr1.product LIKE ?l", "%$piece%");
}
if ($params['pname'] == 'Y') {
$tmp .= db_quote(" OR products.product_code LIKE ?s", "%$piece%");
}
$oc_codes = db_get_fields(" SELECT product_code FROM ?:product_options_inventory");
if (in_array($piece, $oc_codes)) {
$pid = db_get_field(" SELECT product_id FROM ?:product_options_inventory WHERE product_code = '$piece'");
$tmp .= db_quote(" OR products.product_id LIKE ?s", "%$pid%");
}
if ($params['pshort'] == 'Y') {
$tmp .= db_quote(" OR descr1.short_description LIKE ?l", "%$piece%");
}
if ($params['pfull'] == 'Y') {
$tmp .= db_quote(" OR descr1.full_description LIKE ?l", "%$piece%");
}
if ($params['pkeywords'] == 'Y') {
$tmp .= db_quote(" OR (descr1.meta_keywords LIKE ?l OR descr1.meta_description LIKE ?l)", "%$piece%", "%$piece%");
}
if (!empty($params['feature']) && $params['action'] != 'feature_search') {
$tmp .= db_quote(" OR ?:product_features_values.value LIKE ?l", "%$piece%");
}
Hope that helps you.
Thanks,
Brandon
I also have another weird problem, i just added like 20 items by using excel and importing the products in. I added them in, they show up in my admin panel and are all active but they aren't showing up on the main page of the customer end? Everything is the same but they wont show up. Keep in mind I'm only using a community version at the mean time!
There in the right category, they are active, there in the right subcategories but they wont show up on the customer end…
What about the price and inventory? If the price is 0, than they probably won't show up. Also, if you are tracking the inventory and they are at 0, they won't show up.
Beyond that, I'm not sure. Maybe clear your cache?
Hope that helps,
Brandon
Ah ha, your good, I think it was that. I also saw that my products display the “In Stock” feature. The other web page i dont have that displayed. And since you said it had 0, i put in 1 and it showed up! Thanks
Hey will that search code you gave me also change it for the customer page to? like the search function will look at product code, description, etc?
You by chance know how to disable the “in stock” feature cause i sure in hell cant member ha Been awhile since i started from scratch
Yes the code will also work on the customer side.
I think you can disable the inventory tracking in settings => General You can also disable it on a per product level as well.
Brandon
Our work around for this was we just put the product code in the “Search words:” field. This way I didn't have to edit any code and it was very easy to do. I just exported, added it to the field. Now every time we create a new product we just automatically put the product code in the “Search words:” field.
[quote name='clips' timestamp='1320070227' post='124979']
Our work around for this was we just put the product code in the “Search words:” field. This way I didn't have to edit any code and it was very easy to do. I just exported, added it to the field. Now every time we create a new product we just automatically put the product code in the “Search words:” field.
[/quote]
Me too, also this can work as sort of a filter. We have some BIG BIG sizes in ourrange of clothing so when anyone wants to search whats available in say 7xlge then these are searched out in the search words. I didnt add all the sizes in the search words just those extra big ones.Works a treat
John
Thank you for posting the “search by product code” code, Brandon. It was exactly what I was looking for and worked like a charm!
Jennifer