p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   BOOK: Professional WordPress (http://p2p.wrox.com/book-professional-wordpress-567/)
-   -   get current term id for attribute_pa_color (http://p2p.wrox.com/book-professional-wordpress/99593-get-current-term-id-attribute_pa_color.html)

nsdinc August 1st, 2017 12:55 AM

get current term id for attribute_pa_color
 
Hi, Iím trying to convert the selected color on my product pages dropdown box to a PHP variable to use in a custom price table.
Iíve tried using $wpdb but canít figure out how to get the current term id for attribute_pa_color. It works if I manually put the colors term id in. the same happens when I try to use new WP Query () and SQL code.
I can convert to PHP when I use JQuery with a hidden form. This changes the price table to the correct selected color but the image then defaults back to the original default value so the price table and colored image donít match.
Iíve tried XMLHttpRequest() but of course it sends the variable back as HTML. I tried processing the entire table in the XMLHttpRequest() PHP file. This will send the correct color back but will not process the same php code that I use in my other files. Iíve tried calling the header, footer and other files into this file to get the php to work but it even rejects these requests.
Iíve used many varieties of get_the_terms($product->id, 'pa_color') but I get all the colors for that product not the selected one. Again, Iím new at coding and WordPress and would appreciate any help with this.


All times are GMT -4. The time now is 08:36 PM.

Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.