Question:
Where is products_id from the products table joined with the products_options_values table? How is a product linked with its options/values/attributes?
In my code sample below, the $product_option statement: I know this won't work. It's my "monkey see, monkey do" style of programming [i.e., pretty ignorant.] From scouting around in the database, one way that would work [but not very robust] be to check if products_options_values_name = PDF. But I'm not seeing how a product in the products table gets connected to its options.
The rule I'm trying to meet is "Don't show purchase order payment option if any item in the shopping cart is a downloadable non-free item." We have a free PDF download that I want to exclude from the do not show purchase order payment option rule.
Or, I could try and add the order status setting to the purchase order module, if it works as you (Linda) describe for download items. Hmm... can you suggest an example module to try out my monkey-see monkey-do programming skillz?
In includes\modules\payment\po.php (our PO module)
Code:
function selection() {
global $order, $db;
$po_enabled = true;
$products = $order->products;
foreach ($products as $product) {
$product_check = $db->Execute("select product_is_free as free from "
. TABLE_PRODUCTS . " where products_id = '" . zen_get_prid($product['id']) . "'");
$product_option = $db->Execute("select products_options_values_name as
option from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where
products_options_values_id = '" . zen_get_prid($product['id']) . "'");
if ($product_option->fields['option'] == 'PDF' && $product_check->fields['free'] != '1') {
$po_enabled = false;
}
}
If you have any ideas for me, I'd love to hear them. Otherwise, I think it's back to Mr. Chris of Absolute to give it a re-work.
---Diana
Bookmarks