Side_boxes/search.tpl

Please add to serch template in side_boxes/search.tpl search by product code(sku), like in advanced search, i was try by my self but no luck:



i was put like this:







but no results.

Any progress on my request?

Are you trying to get it to searc by SKU field in the serach.tpl box?



If so type=hidden means it isn’t visible to the users to type in? You need to add the actual field

[quote name=‘dominos_2004’]Any progress on my request?[/QUOTE]Sure. Your first try was close, but it will not work because pcode is used as the variable that contains the product code. By setting it to “Y” and entering a product code in the search field creates an AND condition that will never be True. Example: product code is 1234. Your logic becomes IF (Product Description = 1234 AND Product CODE = Y) Display Nothing Found.



This is an easy fix. Leave your pcode=“Y” mod. Now we just need a couple of addition lines of logic. Edit the file includes > common > search_products.php and find this code:



```php // Advanced search conditions (sku, price, weight)

if (!empty($search_data[‘search_product_code’])) {

$search_condition .= " AND products.product_code LIKE ‘%“.$search_data[‘search_product_code’].”%’“;

} ```



Change it to this:



```php // Advanced search conditions (sku, price, weight)

if (!empty($search_data[‘search_product_code’])) {

if ($pcode!=‘Y’) {

$search_condition .= " AND products.product_code LIKE '%”.$search_data[‘search_product_code’].“%'”;

} else {

$search_condition .= " OR products.product_code LIKE ‘%“.$search_string.”%’";

}

} ```



See, that was easy.

[quote name=‘sculptingstudio’]Sure. Your first try was close, but it will not work because pcode is used as the variable that contains the product code. By setting it to “Y” and entering a product code in the search field creates an AND condition that will never be True. Example: product code is 1234. Your logic becomes IF (Product Description = 1234 AND Product CODE = Y) Display Nothing Found.



This is an easy fix. Leave your pcode=“Y” mod. Now we just need a couple of addition lines of logic. Edit the file includes > common > search_products.php and find this code:



```php // Advanced search conditions (sku, price, weight)

if (!empty($search_data[‘search_product_code’])) {

$search_condition .= " AND products.product_code LIKE ‘%“.$search_data[‘search_product_code’].”%’“;

} ```



Change it to this:



```php // Advanced search conditions (sku, price, weight)

if (!empty($search_data[‘search_product_code’])) {

if ($pcode!=‘Y’) {

$search_condition .= " AND products.product_code LIKE '%”.$search_data[‘search_product_code’].“%'”;

} else {

$search_condition .= " OR products.product_code LIKE ‘%“.$search_string.”%’“;

}

} ```



See, that was easy.[/QUOTE]



But in 1.3.4 it’s different:



// Advanced search conditions (sku, price, weight)

$inventory_conidition = ‘’;

if (!empty($search_data[‘search_product_code’])) {

$fields .= “, inventory.combination”;

$search_condition .= " AND (inventory.product_code LIKE '%”.$search_data[‘search_product_code’].“%’ OR products.product_code LIKE '%”.$search_data[‘search_product_code’].“%')”;

$inventory_conidition .= " AND inventory.product_code LIKE ‘%“.$search_data[‘search_product_code’].”%’";

}

[quote name=‘dominos_2004’]But in 1.3.4 it’s different:[/QUOTE]I will upgrade to 1.3.4 once it stabilizes. Then I will revisit this.