Post by Schwimpi » Fri Jul 23, 2021 4:23 am

Code: Select all

("SELECT DISTINCT *, pd.name AS name, p.image, m.name AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND pr.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer m ON (p.manufacturer_id = m.manufacturer_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'");
Trying to add a new column it includes in its search that checks for a value of "1" in a column to be displayed but if its "0" its not shown in the search results.
Any help is greatly appreciated!
Last edited by Schwimpi on Sat Jul 24, 2021 5:02 am, edited 1 time in total.

New member

Posts

Joined
Thu Apr 29, 2021 2:19 am

Post by paulfeakins » Fri Jul 23, 2021 6:00 pm

So just add to the query:

Code: Select all

AND column = 1
And make sure you do it with vQmod or OCMOD.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by Schwimpi » Fri Jul 23, 2021 8:13 pm

paulfeakins wrote:
Fri Jul 23, 2021 6:00 pm
So just add to the query:

Code: Select all

AND column = 1
And make sure you do it with vQmod or OCMOD.
Thanks for the reply. Any idea where I would put it in that sql query?

New member

Posts

Joined
Thu Apr 29, 2021 2:19 am

Post by straightlight » Fri Jul 23, 2021 8:23 pm

Schwimpi wrote:
Fri Jul 23, 2021 8:13 pm
paulfeakins wrote:
Fri Jul 23, 2021 6:00 pm
So just add to the query:

Code: Select all

AND column = 1
And make sure you do it with vQmod or OCMOD.
Thanks for the reply. Any idea where I would put it in that sql query?
Right before:

Code: Select all

");
add:

Code: Select all

 AND `column` = '1'
(add a space at the beginning of AND)

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by straightlight » Fri Jul 23, 2021 8:26 pm

So to add, better to accomplish this by creating an Event rather than playing with core models.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Schwimpi » Fri Jul 23, 2021 10:03 pm

I really appreciate the input. I'm just trying to get a particular search to filter results using a checkbox for a value of 1 if checked and value of 0 if it's not checked. After I put in what you said I get a pile of undefined index notices when I do the search which shows the same items just empty product info boxes. Might have to look for a programmer to do it properly since the search isn't really skipping products marked with 1 or 0.

New member

Posts

Joined
Thu Apr 29, 2021 2:19 am

Post by straightlight » Fri Jul 23, 2021 10:07 pm

Schwimpi wrote:
Fri Jul 23, 2021 10:03 pm
I really appreciate the input. I'm just trying to get a particular search to filter results using a checkbox for a value of 1 if checked and value of 0 if it's not checked. After I put in what you said I get a pile of undefined index notices when I do the search which shows the same items just empty product info boxes. Might have to look for a programmer to do it properly since the search isn't really skipping products marked with 1 or 0.
While the errors are unexplained, I sent you a PM.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by straightlight » Sat Jul 24, 2021 5:03 am

Spoke to the user. User is using a custom folder in the catalog controller to handle his search by brand / make fields. Explained to user that this use of strategy could affect the page ranks and the SEOs since two separate search engines are being used from the same store rather than integrating the features as an extension into the product/search's original route.

User decided to take another route to reach his goals. Wishing him good luck on that one. Therefore, this topic can now be marked as solved.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by by mona » Sat Jul 24, 2021 10:52 pm

That is your product details query from the getProduct function which you should not touch for this.

If you want to influence which products are selected you change the getProducts function.
If you want to affect it always you already have the status field for that.
If you only want to affect that during a product search you would target the part starting with:

Code: Select all

if (!empty($data['filter_name'])) {
and you would mirror any change in function getTotalProducts

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by paulfeakins » Mon Jul 26, 2021 5:52 pm

Schwimpi wrote:
Fri Jul 23, 2021 10:03 pm
Might have to look for a programmer to do it properly
You could pay a developer such as ourselves or post a job in the Commercial Support Forum.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom
Who is online

Users browsing this forum: ravikumar22, Semrush [Bot] and 81 guests