Forums / Bug Reports / Confirmed bugs and workarounds in v1.3.5

Confirmed bugs and workarounds in v1.3.5

Locked

Started by drbyte on 6 Sep 2006, 2:18 AM · Views: 21,896

Results 1 to 18 of 18
This thread is locked. New replies are disabled.
6 Sep 2006, 2:18 AM
#1
drbyte avatar

drbyte

Sensei

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

Confirmed bugs and workarounds in v1.3.5

Following is a list of reported bugs and their workarounds for v1.3.5.

A patch will be released in about a week including these fixes.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

6 Sep 2006, 2:23 AM
#2
drbyte avatar

drbyte

Sensei

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

Re: Confirmed bugs and workarounds in v1.3.5

On local Windows PC, using 09032006.zip > Logged into admin

Footer shows "PROJECT_VERSION_NAME vPROJECT_VERSION_MAJOR.PROJECT_VERSION_MINOR/v1.3.5"

Tools > Server/Version Info shows:
PROJECT_VERSION_NAME PROJECT_VERSION_MAJOR.PROJECT_VERSION_MINOR
Patch: PROJECT_VERSION_PATCH1::PROJECT_VERSION_PATCH1_SOU RCE
Patch: PROJECT_VERSION_PATCH2::PROJECT_VERSION_PATCH2_SOU RCE
Database Patch Level: 1.3.5
v1.3.5 [2006-09-04 07:25:57] (Fresh Installation)

SOLUTION:
Obtain the 09042006.zip or newer and re-install.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

6 Sep 2006, 2:30 AM
#3
drbyte avatar

drbyte

Sensei

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

Re: Confirmed bugs and workarounds in v1.3.5

Problem:> Fatal error: main(): Failed opening required '../includes/classes/db/DB_TYPE/query_factory.php' (include_path='.;c:\php4\pear') in d:\usr\www\html\zen\zc_install\includes\modules\pages\database_upgrade\header_php.php on line 53

SOLUTION:
Obtain the 09042006.zip or newer and re-install.
Upgrader was deleting the configure.php due to mistakenly assuming it was doing fresh install.
Updated zip fixes it.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

6 Sep 2006, 2:33 AM
#4
drbyte avatar

drbyte

Sensei

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

Re: Confirmed bugs and workarounds in v1.3.5

Problem:> Fatal error: Cannot instantiate non-existent class: phpbb in /home/username/public_html/store/includes/autoload_func.php on line 79

**Solution: **
From the release announcements and the whatsnew docs:> phpBB file rename. The file /includes/classes/class.phpBB.php was renamed to lowercase for consistency across webserver platforms. If you fail to rename yours during the upgrade, you will encounter error messages saying that the file cannot be found.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

6 Sep 2006, 2:38 AM
#5
drbyte avatar

drbyte

Sensei

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

Re: Confirmed bugs and workarounds in v1.3.5

Problem while updating currencies:> Fatal error: Call to undefined function curl_init() in ....\admin\includes\functions\localization.php on line 71

SOLUTION:
Obtain the 09042006.zip or newer and re-install.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

6 Sep 2006, 4:32 AM
#6
drbyte avatar

drbyte

Sensei

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

Re: Confirmed bugs and workarounds in v1.3.5

Problem -- affecting UPGRADERS ONLY

Warning: constant(): Couldn't find constant in myroot/includes/init_includes/init_add_crumbs.php on line 45
1064 You have an error in your SQL syntax near 'from where manufacturers_id = 0' at line 2
in:
[select from where manufacturers_id = 0]

SOLUTION:
Apply the following SQL to your database using SQLPatch or phpMyAdmin:```

Updating table get_terms_to_filter

ALTER TABLE get_terms_to_filter ADD get_term_table varchar(64) NOT NULL;
ALTER TABLE get_terms_to_filter ADD get_term_name_field varchar(64) NOT NULL;
UPDATE get_terms_to_filter SET get_term_table = 'TABLE_MANUFACTURERS', get_term_name_field = 'manufacturers_name' where get_term_name = 'manufacturers_id';
UPDATE get_terms_to_filter SET get_term_table = 'TABLE_MUSIC_GENRE', get_term_name_field = 'music_genre_name' where get_term_name = 'music_genre_id';
UPDATE get_terms_to_filter SET get_term_table = 'TABLE_RECORD_COMPANY', get_term_name_field = 'record_company_name' where get_term_name = 'record_company_id';

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

8 Sep 2006, 8:46 AM
#7
drbyte avatar

drbyte

Sensei

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

Re: Confirmed bugs and workarounds in v1.3.5

Problem:
Unable to send SMTP mail using v1.3.5

Solution: (upgrading to v1.3.6 is the BETTER fix !! )
/includes/functions/functions_email.php
line 137
change from```
if (EMAIL_SMTPAUTH_MAIL_PORT != '25' & EMAIL_SMTPAUTH_MAIL_PORT != '') $mail->Port = EMAIL_SMTPAUTH_MAIL_PORT;

    if (EMAIL_SMTPAUTH_MAIL_SERVER_PORT != '25' && EMAIL_SMTPAUTH_MAIL_SERVER_PORT != '') $mail->Port = EMAIL_SMTPAUTH_MAIL_SERVER_PORT;

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

9 Sep 2006, 1:17 AM
#8
ajeh avatar

ajeh

Oba-san

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

Re: Confirmed bugs and workarounds in v1.3.5

PROBLEM: New Products show ALL products regardless of settings

This happens in all places where New Products are addressed ...

SOLUTION: Edit the file:
/includes/functions/functions_lookups.php

Down near the bottom change the whole function for zen_get_new_date_range

NOTE: NEW CODE 9-10-2006
Change the code to read:

// build date range for new products
  function zen_get_new_date_range($time_limit = false) {
    if ($time_limit == false) {
      $time_limit = SHOW_NEW_PRODUCTS_LIMIT;
    }

    // 120 days; 24 hours; 60 mins; 60secs
    $date_range = time() - ($time_limit * 24 * 60 * 60);
// echo 'Now:      '. date('Y-m-d') ."<br />";
// echo $time_limit . ' Days: '. date('Ymd', $date_range) ."<br />";
    $zc_new_date = date('Ymd', $date_range);
    switch (true) {
    case (SHOW_NEW_PRODUCTS_LIMIT == 0):
      $new_range = '';
      break;
    case (SHOW_NEW_PRODUCTS_LIMIT == 1):
      $zc_new_date = date('Ym', time()) . '01';
      $new_range = ' and p.products_date_added >=' . $zc_new_date;
      break;
    default:
      $new_range = ' and p.products_date_added >=' . $zc_new_date;
    }
    return $new_range;
  }

Don't even ask how that got left in there ... it was late ... the coffee ran out ... the candle was flickering ... :cry:

**WARNING: When fixing this function ... there is another function below that for:
**```php
// build date range for upcoming products
function zen_get_upcoming_date_range() {


Do NOT delete that function ... ONLY replace the function zen_get_new_date_range with the new code ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

10 Sep 2006, 3:47 AM
#9
ajeh avatar

ajeh

Oba-san

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

Re: Confirmed bugs and workarounds in v1.3.5

PROBLEM: Banners are displaying when set to status 0 when multiple Banner Groups are used in a single Banner Position

SOLUTION: Edit the file:
/includes/functions/banner.php

Change line 229 from:

      $new_banner_search = ' and ' . $new_banner_search;

To read:

      $new_banner_search = ' and (' . $new_banner_search . ')';

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

15 Sep 2006, 5:49 PM
#10
ajeh avatar

ajeh

Oba-san

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

Re: Confirmed bugs and workarounds in v1.3.5

PROBLEM: Downloads when expired in the Customers ... ... Orders ... does not prevent the customer from obtaining the download when changing the Download status via the green/yellow icon on a per Download basis

Both Max days and Download Count are adjust, and this conflicts with unlimited

SOLUTION: Edit the file:
/admin/orders.php

Change line 52 from:

          $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays='0', download_count='0' where orders_id='" . $_GET['oID'] . "' and orders_products_download_id='" . $_GET['download_reset_off'] . "'";

To read:

          $update_downloads_query = "update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_count='0' where orders_id='" . $_GET['oID'] . "' and orders_products_download_id='" . $_GET['download_reset_off'] . "'";

Now only the download count is adjust and not the max days ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

16 Sep 2006, 1:10 AM
#11
ajeh avatar

ajeh

Oba-san

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

Re: Confirmed bugs and workarounds in v1.3.5

PROBLEM: The breadcrumb displays the Category Name(s) and Product Name when you hit Add to Cart Button IF you have the setting in the Configuration ... My Store ... turned off for:

Display Cart After Adding Product
Display the shopping cart after adding a product (or return back to their origin)

And IF you have the setting set to 0 (OFF) for:

Display Multiple Products Qty Box Status and Set Button Location
Do you want to display Add Multiple Products Qty Box and Set Button Location?

SOLUTION: Edit the file:
/includes/init_includes/init_cart_handler.php

Change line 28 from:

      $parameters = array('action');

To read:

      $parameters = array('action', 'products_id');

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

18 Sep 2006, 12:52 AM
#12
ajeh avatar

ajeh

Oba-san

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

Re: Confirmed bugs and workarounds in v1.3.5

PROBLEM: Tax on COD Fee not added correctly when set

SOLUTION: In includes/modules/order_total/ot_cod_fee.php find line 85

            $order->info['total'] += zen_calculate_tax($cod_cost, $tax);

and immediately after add

           
 if (DISPLAY_PRICE_WITH_TAX == 'true') {
   $cod_cost += zen_calculate_tax($cod_cost, $tax);
 }

NOTE: you may need to adjust the sort order of the Modules ... Order Totals ... COD Fee to 270 (may vary) to suite your needs for the display ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

19 Sep 2006, 9:53 PM
#13
drbyte avatar

drbyte

Sensei

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

Re: Confirmed bugs and workarounds in v1.3.5

Problem:
Page-Not-Found is not showing content provided via the Define Pages editor

Solution:
Add the admin configuration switch via phpMyAdmin:```
insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) values ('Define Page-Not-Found Status', 'DEFINE_PAGE_NOT_FOUND_STATUS', '1', 'Enable the Defined Page-Not-Found Text from define-pages?<br />0= Define Text OFF<br />1= Define Text ON', '25', '67', now(), now(), NULL, 'zen_cfg_select_option(array('0', '1'),');

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

20 Sep 2006, 11:35 PM
#14
ajeh avatar

ajeh

Oba-san

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

Re: Confirmed bugs and workarounds in v1.3.5

PROBLEM: Disappearing Discount Quantities when editing in Products Price Manager

SOLUTION: Edit the file:
/admin/products_price_manager.php

At approximately line 758 to 760, depending on version, where you will see the line:

$i;

Change it to read:

    $i = 0;

NOTE: This bug has existed since at least v1.2.7 ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

25 Sep 2006, 6:44 AM
#15
drbyte avatar

drbyte

Sensei

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

Re: Confirmed bugs and workarounds in v1.3.5

Problem:
template_func.php errors using custom product type and detecting override files

Solution:
edit template_func.php
and replace the line (57) from

$file_pattern = '/'.$file_pattern.'$/';

to

$file_pattern = '/'.str_replace("/", "\/", $file_pattern).'$/';

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

2 Oct 2006, 1:46 AM
#16
ajeh avatar

ajeh

Oba-san

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

Re: Confirmed bugs and workarounds in v1.3.5

PROBLEM: Product Listing bug on Search Results on Add to Cart with qty boxes vs Buy Now button

SOLUTION:
Edit the files:
/includes/modules/pages/advanced_search_result/header_php.php

Around lines 202 - 204 change to read:

//  $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status = 1, s.specials_new_products_price, p.products_price) as final_price ";
$select_str = "SELECT DISTINCT " . $select_column_list .
              " m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_price_sorter, p.products_qty_box_status ";

And an associated fix depending on settings ...

Edit the file:
/includes/modules/product_listing.php

Around lines 138 to 143 change to read:

// qty box with add to cart button
            if (PRODUCT_LIST_PRICE_BUY_NOW == '2' && $listing->fields['products_qty_box_status'] != 0) {
              $lc_button= zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($listing->fields['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product&products_id=' . $listing->fields['products_id']), 'post', 'enctype="multipart/form-data"') . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($listing->fields['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_draw_hidden_field('products_id', $listing->fields['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '</form>';
            } else {
              $lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT, 'class="listingBuyNowButton"') . '</a>';
            }

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

3 Oct 2006, 3:30 AM
#17
ajeh avatar

ajeh

Oba-san

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

Re: Confirmed bugs and workarounds in v1.3.5

PROBLEM: on the Banner Manager ... sometimes the right panel with Edit and Delete buttons disappears

SOLUTION: Edit the file /admin/banner_manager.php

Find the line around 490 that reads:

    $banners_query_raw = "select banners_id, banners_title, banners_image, banners_group, status, expires_date, expires_impressions, date_status_change, date_scheduled, date_added, banners_open_new_windows, banners_on_ssl, banners_sort_order from " . TABLE_BANNERS . " order by banners_title, banners_group";

ABOVE this line add this code:

// Split Page
// reset page when page is unknown
if (($_GET['page'] == '' or $_GET['page'] == '1') and $_GET['bID'] != '') {
  $banners_query_raw = "select banners_id, banners_title, banners_image, banners_group, status, expires_date, expires_impressions, date_status_change, date_scheduled, date_added, banners_open_new_windows, banners_on_ssl, banners_sort_order from " . TABLE_BANNERS . " order by banners_title, banners_group";
  $check_page = $db->Execute($banners_query_raw);
  $check_count=1;
  if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS) {
    while (!$check_page->EOF) {
      if ($check_page->fields['banners_id'] == $_GET['bID']) {
        break;
      }
      $check_count++;
      $check_page->MoveNext();
    }
    $_GET['page'] = round((($check_count/MAX_DISPLAY_SEARCH_RESULTS)+(fmod_round($check_count,MAX_DISPLAY_SEARCH_RESULTS) !=0 ? .5 : 0)),0);
  } else {
    $_GET['page'] = 1;
  }
}

Does that fix this issue of the disappearing right panel and edit delete buttons?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

3 Oct 2006, 8:49 PM
#18
drbyte avatar

drbyte

Sensei

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

Re: Confirmed bugs and workarounds in v1.3.5

**Problem:
**Editing category metatags -- get "duplicate key" errors.

Solution:
/admin/categories.php
starting on line 240:```
// bof: categories meta tags
case 'update_category_meta_tags':
// add or update meta tags
//die('I SEE ' . $action . ' - ' . $_POST['categories_id']);
$categories_id = $_POST['categories_id'];
if (zen_get_category_metatags_keywords($categories_id, (int)$_SESSION['languages_id']) or zen_get_category_metatags_description($categories_id, (int)$_SESSION['languages_id'])) {
$action = 'update_category_meta_tags';
} else {
$action = 'insert_categories_meta_tags';
}

  $languages = zen_get_languages();
  for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
    $language_id = $languages[$i]['id'];

    $sql_data_array = array('metatags_title' => zen_db_prepare_input($_POST['metatags_title'][$language_id]),
                            'metatags_keywords' => zen_db_prepare_input($_POST['metatags_keywords'][$language_id]),
                            'metatags_description' => zen_db_prepare_input($_POST['metatags_description'][$language_id]));

    if ($action == 'insert_categories_meta_tags') {
      $insert_sql_data = array('categories_id' => $categories_id,
                               'language_id' => $language_id);

      $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

      zen_db_perform(TABLE_METATAGS_CATEGORIES_DESCRIPTION, $sql_data_array);
    } elseif ($action == 'update_category_meta_tags') {
      zen_db_perform(TABLE_METATAGS_CATEGORIES_DESCRIPTION, $sql_data_array, 'update', "categories_id = '" . (int)$categories_id . "' and language_id = '" . (int)$language_id . "'");
    }
  }

  zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id));
  break;
  // eof: categories meta tags



change to:```
      // bof: categories meta tags
      case 'update_category_meta_tags':
      // add or update meta tags
      //die('I SEE ' . $action . ' - ' . $_POST['categories_id']);
      $categories_id = $_POST['categories_id'];
      $languages = zen_get_languages();
      for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
        $language_id = $languages[$i]['id'];
        $check = $db->Execute("select *
                               from " . TABLE_METATAGS_CATEGORIES_DESCRIPTION . "
                               where categories_id = '" . (int)$categories_id . "'
                               and language_id = '" . (int)$language_id . "'");
        if ($check->RecordCount() > 0) {
          $action = 'update_category_meta_tags';
        } else {
          $action = 'insert_categories_meta_tags';
        }

        $sql_data_array = array('metatags_title' => zen_db_prepare_input($_POST['metatags_title'][$language_id]),
                                'metatags_keywords' => zen_db_prepare_input($_POST['metatags_keywords'][$language_id]),
                                'metatags_description' => zen_db_prepare_input($_POST['metatags_description'][$language_id]));

        if ($action == 'insert_categories_meta_tags') {
          $insert_sql_data = array('categories_id' => $categories_id,
                                   'language_id' => $language_id);
          $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

          zen_db_perform(TABLE_METATAGS_CATEGORIES_DESCRIPTION, $sql_data_array);
        } elseif ($action == 'update_category_meta_tags') {
          zen_db_perform(TABLE_METATAGS_CATEGORIES_DESCRIPTION, $sql_data_array, 'update', "categories_id = '" . (int)$categories_id . "' and language_id = '" . (int)$language_id . "'");
        }
      }

      zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id));
      break;
      // eof: categories meta tags

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.