Skip to content
This repository has been archived by the owner on Nov 5, 2018. It is now read-only.

Fix the price range widget #152

Closed
loxK opened this issue Sep 6, 2011 · 10 comments
Closed

Fix the price range widget #152

loxK opened this issue Sep 6, 2011 · 10 comments
Milestone

Comments

@loxK
Copy link
Contributor

loxK commented Sep 6, 2011

The price range widget isn't functional and throws a WordPress database error

@divergeinfinity
Copy link
Contributor

Yes, it does. So does the Layered Nav widget.

In jigoshop_query.php, I have unhooked the call to jigoshop_get_products_in_view(). I have it hooked back up locally, but those widgets still don't function as they should.

The question from a 'just plain ugly' labeler was do we need this and why, and that is the answer. I'm working with it.

@loxK
Copy link
Contributor Author

loxK commented Sep 6, 2011

Do you develop with DEBUG to true ?

@divergeinfinity
Copy link
Contributor

Certainly.

@loxK
Copy link
Contributor Author

loxK commented Sep 6, 2011

Warning: implode() [function.implode]: Invalid arguments passed in /srv/www/default/Dev/wordpress/Jigoshop/dev/wp/wp-content/plugins/jigoshop/widgets/price_filter.php on line 93

Warning: implode() [function.implode]: Invalid arguments passed in /srv/www/default/Dev/wordpress/Jigoshop/dev/wp/wp-content/plugins/jigoshop/widgets/price_filter.php on line 95

WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') OR ( wp_posts.post_parent IN () AND wp_posts.post_parent != 0 )' at line 5]
SELECT max(meta_value + 0) FROM wp_posts LEFT JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id WHERE meta_key = 'price' AND ( wp_posts.ID IN () OR ( wp_posts.post_parent IN () AND wp_posts.post_parent != 0 ) )

Which results in a non functional widget (price range is 0-0)

@divergeinfinity
Copy link
Contributor

I'm not getting those ones, but if you un-comment the line for the add_action on the function I mentioned, do you still get that error? The SQL syntax is dependent on $all_post_ids which with the add_action disabled, it is invalid.

I have others similar though:

[05-Sep-2011 20:46:38] PHP Warning: array_intersect(): Argument #2 is not an array in /Library/WebServer/Documents/test/wp-content/plugins/jigoshop/widgets/layered_nav.php on line 92
[05-Sep-2011 20:46:38] PHP Warning: array_intersect(): Argument #2 is not an array in /Library/WebServer/Documents/test/wp-content/plugins/jigoshop/widgets/layered_nav.php on line 92
[05-Sep-2011 20:46:38] PHP Warning: array_intersect(): Argument #2 is not an array in /Library/WebServer/Documents/test/wp-content/plugins/jigoshop/widgets/layered_nav.php on line 92

But they go away with that hook re-activated.

@divergeinfinity
Copy link
Contributor

And I will label this one 'Just PLain Ugly' too. A quick check at the time showed those functions were not being called anywhere within Jigoshop. But the global variable within them was. I'm quite certain we can find a better way to do this.

@loxK
Copy link
Contributor Author

loxK commented Sep 6, 2011

Of course activating the hook solves it. I wonder who desactivated it, without developing an alternative solution...

Anyway we can:
1 ) like it is: one query that retreives all post ids and one query per widget to retrieve min/max prices and attrributes
2 ) one clever query per widgets

I am more into 2)

@loxK
Copy link
Contributor Author

loxK commented Sep 6, 2011

I wonder why are those lines here:
https://github.com/jigoshop/jigoshop/blob/dev/jigoshop.php#L357-362

I can't find anywhere in the code where those session vars are set.

@studioromeo
Copy link
Contributor

They used to be set in the actual widget. The widgets are currently a work in progress

@divergeinfinity
Copy link
Contributor

This commit fixes this:

9e22778

I'll close it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants