Is there a way to get the product_id's in the current listing, no matter the page?
I ask because I would like to experiment with product-filters available on all listings, and think this might help.
//Daniel
Access products_ids of product_listing
- Kofod95
- Senior Contributor
- Posts: 748
- Joined: Sat Feb 06, 2021 7:38 pm
- Phoenix Version: 1.0.8.20
- Has thanked: 99 times
- Been thanked: 179 times
Access products_ids of product_listing
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Access products_ids of product_listing
If you are filtering, wouldn't you want to do it before the IDs are generated? The obvious solution for that would be to modify the listing_sql in listen_filterStart.
You could build a list of IDs from the product_card template (start recording at filterStart and stop at drawForm), but that would give you a list after the products are displayed. The listing_sql would allow you to change the list.
You could build a list of IDs from the product_card template (start recording at filterStart and stop at drawForm), but that would give you a list after the products are displayed. The listing_sql would allow you to change the list.
- Kofod95
- Senior Contributor
- Posts: 748
- Joined: Sat Feb 06, 2021 7:38 pm
- Phoenix Version: 1.0.8.20
- Has thanked: 99 times
- Been thanked: 179 times
Re: Access products_ids of product_listing
Thank you for the reply!
I will use filter_start for the filtering-action, but would like to only show the filters that would actually return any products. Previously, I did that by finding the available option_value_id's in $current_category, but that obviously only works in a category and not on a manufacturers page, specials.php or advanced_search_results.
//Daniel
I will use filter_start for the filtering-action, but would like to only show the filters that would actually return any products. Previously, I did that by finding the available option_value_id's in $current_category, but that obviously only works in a category and not on a manufacturers page, specials.php or advanced_search_results.
Thank you! I'll try working with this!
//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Access products_ids of product_listing
I don't think that approach would work. It would show the IDs in the current search results. But you also want to know the results that do not show on that page. You need something like with the appropriate joins and where clauses. Probably as a subselect since you also would want the manufacturers' name. You can't build what you want in PHP alone. The data is in the database and you'll need to go get it.
Code: Select all
SELECT DISTINCT(p.manufacturers_id) FROM products p