Zen Cart Logo
Forums / Upgrading from 1.3.x to 1.3.9 / Known Bugs (and fixes) with v1.3.8 / v1.3.8a

Known Bugs (and fixes) with v1.3.8 / v1.3.8a

Sticky Locked

Views: 159,422

Results 21 to 40 of 42
This thread is locked. New replies are disabled.
21 May 2008, 4:41 AM
#21
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Known Bugs (and fixes) with v1.3.8 / v1.3.8a

Problem: TEXT Attributes set to TEXTAREA with a limit on number of characters will delete the initially typed text when the maximum number of characters has been reached ...

Example: Maximum is set to 200 and the 201 character is typed and the first 200 characters get deleted when the warning is displayed ...

Solution:
Edit /includes/modules/pages/product_info/jscript_textarea_counter.js

change this:if (excesschars > 0) { field.value = field.value.substring(0, excesschars); alert("Error:\n\n- You are only allowed to enter up to"+maxchars+" characters."); to this:```
if (excesschars > 0) {
field.value = field.value.substring(0, [B]max[/B]chars);
alert("Error:\n\n- You are only allowed to enter up to"+maxchars+" characters.");


Do the same for other product types if needed ...
29 May 2008, 12:44 PM
#22
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Known Bugs (and fixes) with v1.3.8 / v1.3.8a

Several issues have been fixed in the LinkpointAPI payment module since v1.3.8 was first released. They are summarized here, with an updated module file:

The fixes included are:

  • prevents submission of line-item details if partial quantities are entered (ie: any decimal places)
  • prevents submission of line-item details if attribute content is longer than 128 characters - SGS-005000
  • prevents submission of subtotal line-item details if discounts apply (Using v1.3.8 and Linkpoint/yourpay API module along with a discount coupon would cause a SGS-002301 error to appear along with a message saying subtotals and chargetotal don't match)
  • commented code can be uncommented for other OT modules such as ot_loworderfee if needed
  • traps for error condition if SGS-002301 subtotal mismatch occurs
  • accommodates free-shipping cases correctly
  • confirmed to not croak when handling ' marks in product names

Related forum posts:
http://www.zen-cart.com/forum/showthread.php?t=98895
http://www.zen-cart.com/forum/showthread.php?t=87388
http://www.zen-cart.com/forum/showthread.php?t=88813
http://www.zen-cart.com/forum/showthread.php?t=87901
http://www.zen-cart.com/forum/showthread.php?t=94387

NOTE: THESE FIXES ARE ALREADY BUILT-IN TO v1.3.9. YOU SHOULD BE UPGRADING, rather than just patching.

The following file, after unzipping, simply replaces your existing /includes/modules/payment/linkpoint_api.php file:

13 Jun 2008, 11:51 PM
#23
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Known Bugs (and fixes) with v1.3.8 / v1.3.8a

This bug isn't unique to v1.3.8 (has existed for many versions) but only shows in PHP5.
**
Symptom:
**Fatal error: Cannot use object of type queryFactoryResult as array in /home/mydomain/public_html/admin/includes/graphs/banner_monthly.php on line 41

**Solution:
**Edit /admin/includes/graphs/banner_monthly.php ... line 41
Add the text as shown:

  $graph->SetTitle(sprintf(TEXT_BANNERS_MONTHLY_STATISTICS, $banner[B]->fields[/B]['banners_title'], $year));
12 Sep 2008, 8:02 PM
#24
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Known Bugs (and fixes) with v1.3.8 / v1.3.8a

Problem: Minimum or Maximum or Units is not processing with attributes properly when added to cart ... also affects quantity discounts on mixed

Solution:
/includes/classes/shopping_cart.php
at lines 1401 and 1435 you have code that looks like this:// reset($this->contents); // breaks cart $check_contents = $this->contents; while (list($products_id, ) = each($check_contents)) {add an extra line in both places, making it look like this:```
// reset($this->contents); // breaks cart
$check_contents = $this->contents;
[B] reset($check_contents);[/B]
while (list($products_id, ) = each($check_contents)) {

16 Sep 2008, 5:12 PM
#25
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Known Bugs (and fixes) with v1.3.8 / v1.3.8a

ISSUE WITH GODADDY HOSTING CUSTOMERS VS PAYPAL

GoDaddy has made a change to their server configuration so that their proxy servers are no longer required.

The fix:
1. IF YOU ARE USING GODADDY HOSTING, go to Admin->Configuration->My Store->CURL Proxy Status, and turn it off.

**That should be enough.
**

Alternate, "fix" which should NOT be needed:
2. THE FOLLOWING SHOULD NOT BE REQUIRED, but is left for reference:
This change in proxy configuration breaks the bandages originally added to the PayPal IPN handling to accommodate the need for the proxy ... and thus breaks the ability of the PayPal modules to receive updates from PayPal regarding transactions made in your stores.

This affects all the PayPal modules, and is unique to GoDaddy hosting accounts.
a) PayPal Website Payments Standard (IPN) transactions will not register in your store at all.
b) PayPal Website Payments Pro transactions will not see updates made such as refunds.
c) **Express Checkout **transactions will not show updates made such as refunds

The quick workaround to this is to make two small edits to one file:

/includes/modules/payment/paypal/paypal_functions.php
Around line 443 you'll see the following section of code.
Make the changes by adding the text shown in red:```
$proxy = $web;
if ([B]false && [/B]CURL_PROXY_REQUIRED == 'True' && CURL_PROXY_SERVER_DETAILS != '') {
$proxy = parse_url($scheme . CURL_PROXY_SERVER_DETAILS);
$ssl = ($ssl == '') ? 'http://' : $ssl;
}

  //Post Data
  if ([B]false && [/B]CURL_PROXY_REQUIRED == 'True' && CURL_PROXY_SERVER_DETAILS != '') {
    $header  = "POST " . $ssl . $web[host] . $web[path] . " HTTP/1.1\r\n";
    $header .= "Host: $proxy[host]\r\n";
  } else {
    $header  = "POST $web[path] HTTP/1.1\r\n";
    $header .= "Host: $web[host]\r\n";
  }

The proxy support will no longer be needed for future.
24 Sep 2008, 1:41 AM
#26
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Known Bugs (and fixes) with v1.3.8 / v1.3.8a

Problem: Multiple Languages showing in What's New sidebox

Solution: edit the file:
/includes/modules/sideboxes/whats_new.php

Change the select statement to read:

  $random_whats_new_sidebox_product_query = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name,
                                              p.master_categories_id
                           from (" . TABLE_PRODUCTS . " p
                           left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )
                           where p.products_id = pd.products_id
[B]                           and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
[/B]                           and p.products_status = 1 " . $display_limit;
13 Nov 2008, 4:24 PM
#27
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Known Bugs (and fixes) with v1.3.8 / v1.3.8a

Problem: In Admin customers display the right panel displays a $0.00 Gift Certificate balance when no order exists yet for a customer.

Solution: Add a function and change the display for the right panel

Add this function to the:
/admin/includes/functions/general.php

    function zen_user_has_gv_balance($c_id) {
      global $db;
        $gv_result = $db->Execute("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . (int)$c_id . "'");
        if ($gv_result->RecordCount() > 0) {
          if ($gv_result->fields['amount'] > 0) {
            return $gv_result->fields['amount'];
          }
        }
        return 0;
    }

Then edit the file:
/admin/customers.php

And change:

        $contents[] = array('text' => '<br />' . TEXT_INFO_GV_AMOUNT . ' ' . $currencies->format($customers_orders->fields['amount']));

to read:

        $customer_gv_balance = zen_user_has_gv_balance($cInfo->customers_id);
        $contents[] = array('text' => '<br />' . TEXT_INFO_GV_AMOUNT . ' ' . $currencies->format($customer_gv_balance));
22 Dec 2008, 3:26 PM
#28
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Known Bugs (and fixes) with v1.3.8 / v1.3.8a

Problem: Sales made with Salemaker having trouble on some sales with Linked Products ...

Solution: update the code on the following files ...
Change the file:
/includes/functions/functions_lookups.php

Find the code:

/*
 * Return a product's category
 * TABLES: products_to_categories
 */
  function zen_get_products_category_id($products_id) {
    global $db;

    $the_products_category_query = "select products_id, categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$products_id . "'" . " order by products_id,categories_id";
    $the_products_category = $db->Execute($the_products_category_query);

    return $the_products_category->fields['categories_id'];
  }

and change to read:

/*
 * Return a product's category
 * TABLES: products_to_categories
 */
  function zen_get_products_category_id($products_id) {
    global $db;

    $the_products_category_query = "select products_id, master_categories_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'";
    $the_products_category = $db->Execute($the_products_category_query);

    return $the_products_category->fields['master_categories_id'];
  }

Then, in the Admin find the code in:
/admin/includes/functions/general.php

that reads:

////
// Return a product's category
// TABLES: products_to_categories
  function zen_get_products_category_id($products_id) {
    global $db;

    $the_products_category_query = "select products_id, categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . $products_id . "'" . " order by products_id,categories_id";
    $the_products_category = $db->Execute($the_products_category_query);

    return $the_products_category->fields['categories_id'];
  }

and change to read:

////
// Return a product's category
// TABLES: products_to_categories
  function zen_get_products_category_id($products_id) {
    global $db;

    $the_products_category_query = "select products_id, master_categories_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'";
    $the_products_category = $db->Execute($the_products_category_query);

    return $the_products_category->fields['master_categories_id'];
  }
8 Mar 2009, 3:45 PM
#30
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Known Bugs (and fixes) with v1.3.8 / v1.3.8a

Problem: Looking up fields in products and products_description and looking up fields in categories and categories_description ...

There are two function in the functions_lookups that will pull any field that you need from the products or products_description tables by just passing it the products_id ... and for pulling any field from the categories and categories_description tables just by passing the categories_id ...

However there is an error in both of them that needs a minor fix ...

The original code for product lookup:
/includes/functions/functions_lookups.php

/*
 * Return any field from products or products_description table
 * Example: zen_products_lookup('3', 'products_date_added');
 */
  function zen_products_lookup($product_id, $what_field = 'products_name', $language = '') {
    global $db;

    if (empty($language)) $language = $_SESSION['languages_id'];

    $product_lookup = $db->Execute("select " . $what_field . " as lookup_field
                              from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                              where p.products_id ='" . (int)$product_id . "'
                              and pd.language_id = '" . (int)$language . "'");

    $return_field = $product_lookup->fields['lookup_field'];

    return $return_field;
  }

The original code for category lookup :

/*

  • Return any field from categories or categories_description table

  • Example: zen_categories_lookup('10', 'parent_id');
    */
    function zen_categories_lookup($categories_id, $what_field = 'categories_name', $language = '') {
    global $db;

    if (empty($language)) $language = $_SESSION['languages_id'];

    $category_lookup = $db->Execute("select " . $what_field . " as lookup_field
    from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
    where c.categories_id ='" . (int)$categories_id . "'
    and cd.language_id = '" . (int)$language . "'");

    $return_field = $category_lookup->fields['lookup_field'];

    return $return_field;
    }

However, there is a little bug in these that you will want to update:

The new code for products look up:

/*
 * Return any field from products or products_description table
 * Example: zen_products_lookup('3', 'products_date_added');
 */
  function zen_products_lookup($product_id, $what_field = 'products_name', $language = '') {
    global $db;

    if (empty($language)) $language = $_SESSION['languages_id'];

    $product_lookup = $db->Execute("select " . $what_field . " as lookup_field
                              from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                              where p.products_id ='" . (int)$product_id . "'
                              and pd.products_id = p.products_id
                              and pd.language_id = '" . (int)$language . "'");

    $return_field = $product_lookup->fields['lookup_field'];

    return $return_field;
  }

The new code for categories look up:

/*
 * Return any field from categories or categories_description table
 * Example: zen_categories_lookup('10', 'parent_id');
 */
  function zen_categories_lookup($categories_id, $what_field = 'categories_name', $language = '') {
    global $db;

    if (empty($language)) $language = $_SESSION['languages_id'];

    $category_lookup = $db->Execute("select " . $what_field . " as lookup_field
                              from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
                              where c.categories_id ='" . (int)$categories_id . "'
                              and c.categories_id = cd.categories_id
                              and cd.language_id = '" . (int)$language . "'");

    $return_field = $category_lookup->fields['lookup_field'];

    return $return_field;
  }
10 Mar 2009, 10:44 PM
#31
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Known Bugs (and fixes) with v1.3.8 / v1.3.8a

Problem: Lookup of fields in products or products_description by products_id in the Admin

Solution: change the function file:
/admin/includes/functions/general.php

from approximately lines 3120 to 3138 where it reads:

////
// return any field from products or products_description table
// Example: zen_products_lookup('3', 'products_date_added');
//  function zen_products_lookup($product_id, $what_field = 'products_name', $language = $_SESSION['languages_id']) {
  function zen_products_lookup($product_id, $what_field = 'products_name', $language = '') {
    global $db;

    if (empty($language)) $language = $_SESSION['languages_id'];

    $product_lookup = $db->Execute("select " . $what_field . " as lookup_field
                              from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                              where p.products_id ='" . $product_id . "'
                              and pd.language_id = '" . $language . "'");

    $return_field = $product_lookup->fields['lookup_field'];

    return $return_field;
  }

To read:

////
// return any field from products or products_description table
// Example: zen_products_lookup('3', 'products_date_added');
//  function zen_products_lookup($product_id, $what_field = 'products_name', $language = $_SESSION['languages_id']) {
  function zen_products_lookup($product_id, $what_field = 'products_name', $language = '') {
    global $db;

    if (empty($language)) $language = $_SESSION['languages_id'];

    $product_lookup = $db->Execute("select " . $what_field . " as lookup_field
                              from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                              where  p.products_id ='" . $product_id . "'
                              and pd.products_id = p.products_id
                              and pd.language_id = '" . $language . "'");

    $return_field = $product_lookup->fields['lookup_field'];

    return $return_field;
  }

Thanks for catching the forgotten update, torvista ...

7 Apr 2009, 9:12 PM
#32
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Known Bugs (and fixes) with v1.3.8 / v1.3.8a

**Symptom: **PayPal Website Payments Standard transcations not completing properly and the following PHP error occurs while processing the IPN notification: > PHP Fatal error: Call to a member function add() on a non-object in /includes/functions/functions_email.php on line 287

**Workaround: To attempt to stop the "fatal" error when the email error occurs, try the following:
Edit /includes/auto_loaders/paypal_ipn.core.php
and add this to the end of the file (and remove the ?> on the last line if it exists in the file):```
/

  • Breakpoint 130.
  • messageStack = new messageStack();

*/
$autoLoadConfig[130][] = array('autoType'=>'classInstantiate',
'className'=>'messageStack',
'objectName'=>'messageStack');

22 May 2009, 6:01 PM
#33
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Known Bugs (and fixes) with v1.3.8 / v1.3.8a

Problem: Attempting to redeem a gift certificate using an invalid code can cause a MySQL error to appear.

Solution: Make the following code change:
Edit /includes/modules/order_total/ot_gv.php
Around line 219 you'll see this section of code:// check for validity $gv_result = $db->Execute("select coupon_id, coupon_type, coupon_amount from " . TABLE_COUPONS . " where coupon_code = '" . zen_db_prepare_input($_POST['gv_redeem_code']) . "'");Add the new line as shown:```
// check for validity
[B] $_POST['gv_redeem_code'] = preg_replace('/[^0-9a-zA-Z]/', '', $_POST['gv_redeem_code']);[/B]
$gv_result = $db->Execute("select coupon_id, coupon_type, coupon_amount from " . TABLE_COUPONS . " where coupon_code = '" . zen_db_prepare_input($_POST['gv_redeem_code']) . "'");

29 Jul 2009, 2:10 PM
#34
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Known Bugs (and fixes) with v1.3.8 / v1.3.8a

**Problem:
**"1064 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 '-0, 0' at line 11"

This can also result in PCI scans failing.

Discussed in more detail here: http://www.zen-cart.com/forum/showthread.php?t=108941

**Cause:
**If you set any of the Admin->Configuration->Maximum Values to zero, the above situation may occur.

**Fix:
**There are a few ways to avert this situation:

a) Don't set Maximum Value settings to 0.

b) Change /includes/classes/split_page_results.php to detect 0 values and assign something different if that happens:
At line 25 find this section, and insert the new line as highlighted:```
/* class constructor /
function splitPageResults($query, $max_rows, $count_key = '
', $page_holder = 'page', $debug = false) {
global $db;
[B] $max_rows = ($max_rows == '' || $max_rows == 0) ? 20 : $max_rows;[/B]
$this->sql_query = $query;
$this->page_name = $page_holder;


c) Change /includes/classes/split_page_results.php to handle the "-0" situation more gracefully if it ever occurs:
At line 84, find this:```
    // fix offset error on some versions
    if ($offset [B]<[/B] 0) { $offset = 0; }

    $this->sql_query .= " limit " . [B]$offset[/B] . ", " . $this->number_of_rows_per_page;
  }
```and change it to this:```
      // fix offset error on some versions
    if ($offset[B] <= [/B]0) { $offset = 0; }

    $this->sql_query .= " limit " . [B]($offset > 0 ? $offset . ", " : '')[/B] . $this->number_of_rows_per_page;
}

I recommend implementing all three :blush:

4 Aug 2009, 8:29 PM
#35
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Known Bugs (and fixes) with v1.3.8 / v1.3.8a

Problem: Shipping module tax calculations not honoring the tax_basis flag setting.

Solution: Small code change posted here: http://www.zen-cart.com/forum/showthread.php?t=133906

27 Sep 2009, 4:41 PM
#36
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Known Bugs (and fixes) with v1.3.8 / v1.3.8a

There are some cases when a 10413 error will occur with a PayPal Express Checkout transaction. It seems to be associated mostly with stores who use the tax-included pricing option.

A workaround which has produced moderate success is this:
edit /includes/modules/payment/paypalwpp.php
around line 535 you'll see:$response = $doPayPal->DoExpressCheckoutPayment($_SESSION['paypal_ec_token'], $_SESSION['paypal_ec_payer_id'], [B] number_format((isset($options['AMT']) ? $options['AMT'] : $order_amount), 2),[/B] $options);Change that by adding/editing as follows:```
[B] if (!isset($options['AMT'])) $options['AMT'] = number_format($order_amount, 2, '.', '');[/B]
$response = $doPayPal->DoExpressCheckoutPayment($_SESSION['paypal_ec_token'],
$_SESSION['paypal_ec_payer_id'],
[B]$options['AMT'],[/B]
$options);

Additionally, MAKE SURE you have the ot_subtotal module enabled in Admin->Modules->Order Total.

*Fix inspired by a thought by lsenft*
8 Oct 2009, 4:54 PM
#37
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Known Bugs (and fixes) with v1.3.8 / v1.3.8a

Problem: Discount Coupon Category Restrictions are not always working right ...

Solution: change a function in:
/includes/functions/functions_general.php

around lines 856 - 879 with:

  function validate_for_category($product_id, $coupon_id) {
    global $db;
    $retVal = 'none';
    $productCatPath = zen_get_product_path($product_id);
    $catPathArray = array_reverse(explode('_', $productCatPath));
    $sql = "SELECT count(*) AS total
            FROM " . TABLE_COUPON_RESTRICT . "
            WHERE category_id = -1
            AND coupon_restrict = [B]'Y'
            AND coupon_id = " . (int)$coupon_id . " LIMIT 1"[/B];
    $checkQuery = $db->execute($sql);
    foreach ($catPathArray as $catPath) {
      $sql = "SELECT * FROM " . TABLE_COUPON_RESTRICT . "
              WHERE category_id = " . (int)$catPath . "
              AND coupon_id = " . (int)$coupon_id;
      $result = $db->execute($sql);
      if ($result->recordCount() > 0 && $result->fields['coupon_restrict'] == 'N') return true;
      if ($result->recordCount() > 0 && $result->fields['coupon_restrict'] == 'Y') return false;
    }
    if ($checkQuery->fields['total'] > 0) {
      return false;
    } else {
      return 'none';
    }
  }
14 Dec 2009, 12:50 AM
#38
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Known Bugs (and fixes) with v1.3.8 / v1.3.8a

Symptom: An order is received, but is marked as being paid-for via a module whose "Enabled" status was set to "False".

Solutions: There are two recommended steps:

  1. If you are NOT using a given module on your site, then click Remove.
    Leaving it active with only setting its "enabled" status to "false" causes the system to have to process that module's code even though it's false. The only reason to leave it installed but left as enabled=false is if you have added custom code to the module to have it self-enable only during certain circumstances. Otherwise the module should be Remove by clicking the Remove button.

  2. Make the following code edit to help the system handle exceptions more consistently:

/includes/classes/payment.php
Change line 74:$GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class'];By replacing that one line with these several lines:```
$paymentClass = new $include_modules[$i]['class'];
if ($paymentClass->enabled)
{
$GLOBALS[$include_modules[$i]['class']] = $paymentClass;
}

18 Dec 2009, 3:08 AM
#39
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Known Bugs (and fixes) with v1.3.8 / v1.3.8a

Problem: Submitting PayPal Express Checkout transactions in JPY currency may have problems if currency exchange happens based on exchange rates for JPY that are not whole numbers.

Solution: Minor code change as posted here: http://www.zen-cart.com/forum/showpost.php?p=817294&postcount=14

5 Feb 2010, 5:24 PM
#40
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Known Bugs (and fixes) with v1.3.8 / v1.3.8a

Problem: Issues where adding Product with Attributes adds to the quantity of the same Product with a different Attribute combination ...

Solution: Update the function zen_get_uprid in the file:
/includes/functions/functions_general.php

and change the function:

////
// Return a product ID with attributes
  function zen_get_uprid($prid, $params) {
//print_r($params);
    $uprid = $prid;
    if ( (is_array($params)) && (!strstr($prid, ':')) ) {
      while (list($option, $value) = each($params)) {
        if (is_array($value)) {
          while (list($opt, $val) = each($value)) {
            $uprid = $uprid . '{' . $option . '}' . trim($opt);
          }
          break;
        }
        //CLR 030714 Add processing around $value. This is needed for text attributes.
        $uprid = $uprid . '{' . $option . '}' . trim($value);
      }
    //CLR 030228 Add else stmt to process product ids passed in by other routines.
      $md_uprid = '';

      $md_uprid = md5($uprid);
      return $prid . ':' . $md_uprid;
    } else {
      return $prid;
    }
  }

to read:

////
// Return a product ID with attributes
  function zen_get_uprid($prid, $params) {
//print_r($params);
    $uprid = $prid;
    if ( (is_array($params)) && (!strstr($prid, ':')) ) {
      while (list($option, $value) = each($params)) {
        if (is_array($value)) {
          while (list($opt, $val) = each($value)) {
            $uprid = $uprid . '{' . $option . '}' . trim($opt);
          }
        } else {
        //CLR 030714 Add processing around $value. This is needed for text attributes.
            $uprid = $uprid . '{' . $option . '}' . trim($value);
        }
      }      //CLR 030228 Add else stmt to process product ids passed in by other routines.
      $md_uprid = '';

      $md_uprid = md5($uprid);
      return $prid . ':' . $md_uprid;
    } else {
      return $prid;
    }
  }

thanks to more-solutions for bringing this to our attention with a solution to correct the problem ...