Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Dr_DK

Pioneers
  • Posts

    82
  • Joined

  • Last visited

  • Days Won

    1

Reputation Activity

  1. Like
    Dr_DK got a reaction from hazzardouz1988 in [Contribution] Option Types v2   
    @rknabe - You are right. I had the same problem, I think DunWeb missed a few things. I had to download v2 of option types and look at their versions to compare.
     
    In the includes/classes/shopping_cart.php make the following changes:
     
    Comment out lines 103-109:
    /* reset($attributes); while (list($option, $value) = each($attributes)) { if (!is_numeric($option) || !is_numeric($value)) { $attributes_pass_check = false; break; } else { $check_query = tep_db_query("select products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "' limit 1"); if (tep_db_num_rows($check_query) < 1) { $attributes_pass_check = false; break; } } } } elseif (tep_has_product_attributes($products_id)) { $attributes_pass_check = false; } */
     
    Find lines 131-133:
    $this->contents[$products_id_string]['attributes'][$option] = $value; // insert into database if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$option . "', '" . (int)$value . "')");
     
    Replace with:

    //BOF - Zappo - Option Types v2 - Check options loop, and add attributes accordingly... $attr_value = NULL; $blank_value = FALSE; if (strstr($option, TEXT_PREFIX)) { //Check for Text and Upload Options if (trim($value) == NULL) { //Check if the Text Option has a value (Or is the value blank?) $blank_value = TRUE; } else { //Value is valid and contains data --> Add Text Option value $option = str_replace(TEXT_PREFIX,'',$option); $attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES); $value = OPTIONS_VALUE_TEXT_ID; $this->contents[$products_id_string]['attributes_values'][$option] = $attr_value; } } if (!$blank_value) { // If the Value is valid and Contains Data, add the option to the Cart.... $this->contents[$products_id_string]['attributes'][$option] = $value; // insert into database // - Zappo - Option Types v2 - Added products_options_value_text For saving Text and Upload Option Values if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id, products_options_value_text) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . $option . "', '" . (int)$value . "', '" . tep_db_input($attr_value) . "')"); } //EOF - Zappo - Option Types v2 - Check options loop, and add attributes accordingly...
     
    Comment out line 175-184:
    /* if (is_array($attributes)) { reset($attributes); while (list($option, $value) = each($attributes)) { if (!is_numeric($option) || !is_numeric($value)) { $attributes_pass_check = false; break; } } } */
     
    Find around lines 193-195:
    $this->contents[$products_id_string]['attributes'][$option] = $value; // update database if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$value . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id_string) . "' and products_options_id = '" . (int)$option . "'");
     
    Replace it with:
    //BOF - Zappo - Option Types v2 - Check options loop for Text & Uploads, and add attributes accordingly... $attr_value = NULL; $blank_value = FALSE; if (strstr($option, TEXT_PREFIX)) { //Check for Text and Upload Options if (trim($value) == NULL) { //Check if the Text Option has a value (Or is the value blank?) $blank_value = TRUE; } else { //Value is valid and contains data --> Prepare for database $option = str_replace(TEXT_PREFIX,'',$option); $attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES); $value = OPTIONS_VALUE_TEXT_ID; $this->contents[$products_id_string]['attributes_values'][$option] = $attr_value; } } if (!$blank_value) { $this->contents[$products_id_string]['attributes'][$option] = $value; // update database if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$value . "', products_options_value_text = '" . tep_db_input($attr_value) . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "' and products_options_id = '" . (int)$option . "'"); } //EOF - Zappo - Option Types v2 - Check options loop for Text & Uploads, and add attributes accordingly...
     
    Find around line 356:
    global $customer_id;
    Add below it:
    //BOF - Zappo - Option Types v2 - ONE LINE - Add call to tep_get_uprid to correctly format product ids containing quotes $products_id = tep_get_uprid($products_id, $attributes);
     
    Find around line 378:
    'image' => $products['products_image'],
    Add below it:
    'attributes_values' => (isset($this->contents[$products_id]['attributes_values']) ? $this->contents[$products_id]['attributes_values'] : ''),
     
     
    Hope that helps. Share if you find something else that needs modifying! :-)
×
×
  • Create New...