Results 1 to 10 of 32

Hybrid View

  1. #1
    Join Date
    Feb 2004
    Location
    Georgia, USA
    Posts
    1,948
    Plugin Contributions
    0

    Default Shopping Cart Error when enabling inline shipping estimator?

    I am getting this error messaging when updating quantity in shopping cart. This doesn't happen everything time:

    Fatal error: Cannot redeclare class order in /includes/classes/order.php on line 20

    Using ZCV 1.3.8a, PHP 5.2.5, MYSQL 5.0.45 and Apache 2.0

  2. #2
    Join Date
    Jan 2004
    Posts
    66,445
    Plugin Contributions
    81

    Default Re: Shopping Cart Error

    Maybe a bug in your own code, but not a bug in Zen Cart in general. (Moving post out of the bug reports area)

    "cannot redeclare class" only happens when a PHP file containing the class specified gets loaded a second time.
    And that usually only happens when you have extra copies of files left on your server such as shopping_cart_orig.php alongside shopping_cart.php etc, or if you have accidentally put the same class file in another folder whose contents are automatically processed such as extra_functions or extra_datafiles etc.

    Find out the pattern behind "it only happens sometimes", and then get rid of the duplicate loading that's happening.
    .

    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.

  3. #3
    Join Date
    Feb 2004
    Location
    Georgia, USA
    Posts
    1,948
    Plugin Contributions
    0

    Default Re: Shopping Cart Error

    Quote Originally Posted by DrByte View Post
    Maybe a bug in your own code, but not a bug in Zen Cart in general.

    "cannot redeclare class" only happens when a PHP file containing the class specified gets loaded a second time.
    And that usually only happens when you have extra copies of files left on your server such as shopping_cart_orig.php alongside shopping_cart.php etc, or if you have accidentally put the same class file in another folder whose contents are automatically processed such as extra_functions or extra_datafiles etc.

    Find out the pattern behind "it only happens sometimes", and then get rid of the duplicate loading that's happening.

    DrByte, if you can give me more pointers that would be great. I am not seeming to find any duplicate files or renamed files. I also have not installed any mods lately so I am lost a bit with this. Hmm...on a second thought, would loading the debugger mod be appropriate in this situation?

    Thanks!

  4. #4
    Join Date
    Feb 2004
    Location
    Georgia, USA
    Posts
    1,948
    Plugin Contributions
    0

    Default Re: [not a bug] Shopping Cart Error

    Well, I figure out that this only happens when I turn on the in-line display of shipping estimate. Now I just need to go figure out why that's the case. I change the option from 1 (display shipping estimate button) to a 2 and that's when the problem started. Now that I changed it back to 1 things are working fine but I'd really like the inline display. I will dig more.

  5. #5
    Join Date
    Jan 2004
    Posts
    66,445
    Plugin Contributions
    81

    Default Re: [not a bug] Shopping Cart Error

    What version of Zen Cart are you using?
    Have you customized any of these files? How are they different from the defaults?
    /includes/classes/shopping_cart.php
    /includes/modules/[override?]/shipping_estimator.php
    /includes/templates/[your_template]/templates/tpl_shopping_cart_default.php
    /includes/templates/[your_template]/templates/tpl_modules_shipping_estimator.php
    .

    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. #6
    Join Date
    Feb 2004
    Location
    Georgia, USA
    Posts
    1,948
    Plugin Contributions
    0

    Default Re: [not a bug] Shopping Cart Error

    Quote Originally Posted by DrByte View Post
    What version of Zen Cart are you using?
    Have you customized any of these files? How are they different from the defaults?
    /includes/classes/shopping_cart.php
    /includes/modules/[override?]/shipping_estimator.php
    /includes/templates/[your_template]/templates/tpl_shopping_cart_default.php
    /includes/templates/[your_template]/templates/tpl_modules_shipping_estimator.php
    The only file customized is the tpl_shopping_cart_default.php to include display of Google Checkout button. I have pasted the code for that file below:
    PHP Code:
    <?php
    /**
     * Page Template
     *
     * Loaded automatically by index.php?main_page=shopping_cart.<br />
     * Displays shopping-cart contents
     *
     * @package templateSystem
     * @copyright Copyright 2003-2007 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: tpl_shopping_cart_default.php 5554 2007-01-07 02:45:29Z drbyte $
     * @version $Id: tpl_shopping_cart_default.php 5936 2007-12-14 18:15:39Z ropu - Added Google Checkout $
     */
    ?>
    <div class="centerColumn" id="shoppingCartDefault">
    <?php
      
    if ($flagHasCartContents) {
    ?>

    <?php
      
    if ($_SESSION['cart']->count_contents() > 0) {
    ?>
    <div class="forward"><?php echo TEXT_VISITORS_CART?></div>
    <?php
      
    }
    ?>

    <h1 id="cartDefaultHeading"><?php echo HEADING_TITLE?></h1>

    <?php if ($messageStack->size('shopping_cart') > 0) echo $messageStack->output('shopping_cart'); ?>

    <?php echo zen_draw_form('cart_quantity'zen_href_link(FILENAME_SHOPPING_CART'action=update_product')); ?>
    <div id="cartInstructionsDisplay" class="content"><?php echo TEXT_INFORMATION?></div>

    <?php if (!empty($totalsDisplay)) { ?>
      <div class="cartTotalsDisplay important"><?php echo $totalsDisplay?></div>
      <br class="clearBoth" />
    <?php ?>

    <?php  if ($flagAnyOutOfStock) { ?>

    <?php    if (STOCK_ALLOW_CHECKOUT == 'true') {  ?>

    <div class="messageStackError"><?php echo OUT_OF_STOCK_CAN_CHECKOUT?></div>

    <?php    } else { ?>
    <div class="messageStackError"><?php echo OUT_OF_STOCK_CANT_CHECKOUT?></div>

    <?php    //endif STOCK_ALLOW_CHECKOUT ?>
    <?php  
    //endif flagAnyOutOfStock ?>

    <table  border="0" width="100%" cellspacing="0" cellpadding="0" id="cartContentsDisplay">
         <tr class="tableHeading">
            <th scope="col" id="scQuantityHeading"><?php echo TABLE_HEADING_QUANTITY?></th>
            <th scope="col" id="scUpdateQuantity">&nbsp;</th>
            <th scope="col" id="scProductsHeading"><?php echo TABLE_HEADING_PRODUCTS?></th>
            <th scope="col" id="scUnitHeading"><?php echo TABLE_HEADING_PRICE?></th>
            <th scope="col" id="scTotalHeading"><?php echo TABLE_HEADING_TOTAL?></th>
            <th scope="col" id="scRemoveHeading">&nbsp;</th>
         </tr>
             <!-- Loop through all products /-->
    <?php
      
    foreach ($productArray as $product) {
    ?>
         <tr class="<?php echo $product['rowClass']; ?>">
           <td class="cartQuantity">
    <?php
      
    if ($product['flagShowFixedQuantity']) {
        echo 
    $product['showFixedQuantityAmount'] . '<br /><span class="alert bold">' $product['flagStockCheck'] . '</span><br /><br />' $product['showMinUnits'];
      } else {
        echo 
    $product['quantityField'] . '<br /><span class="alert bold">' $product['flagStockCheck'] . '</span><br /><br />' $product['showMinUnits'];
      }
    ?>
           </td>
           <td class="cartQuantityUpdate">
    <?php
      
    if ($product['buttonUpdate'] == '') {
        echo 
    '' ;
      } else {
        echo 
    $product['buttonUpdate'];
      }
    ?>
           </td>
           <td class="cartProductDisplay">
    <a href="<?php echo $product['linkProductsName']; ?>"><span id="cartImage" class="back"><?php echo $product['productsImage']; ?></span><span id="cartProdTitle"><?php echo $product['productsName'] . '<span class="alert bold">' $product['flagStockCheck'] . '</span>'?></span></a>
    <br class="clearBoth" />


    <?php
      
    echo $product['attributeHiddenField'];
      if (isset(
    $product['attributes']) && is_array($product['attributes'])) {
      echo 
    '<div class="cartAttribsList">';
      echo 
    '<ul>';
        
    reset($product['attributes']);
        foreach (
    $product['attributes'] as $option => $value) {
    ?>

    <li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER nl2br($value['products_options_values_name']); ?></li>

    <?php
        
    }
      echo 
    '</ul>';
      echo 
    '</div>';
      }
    ?>
           </td>
           <td class="cartUnitDisplay"><?php echo $product['productsPriceEach']; ?></td>
           <td class="cartTotalDisplay"><?php echo $product['productsPrice']; ?></td>
           <td class="cartRemoveItemDisplay">
    <?php
      
    if ($product['buttonDelete']) {
    ?>
               <a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART'action=remove_product&product_id=' $product['id']); ?>"><?php echo zen_image($template->get_template_dir(ICON_IMAGE_TRASHDIR_WS_TEMPLATE$current_page_base,'images/icons'). '/' ICON_IMAGE_TRASHICON_TRASH_ALT); ?></a>
    <?php
      
    }
      if (
    $product['checkBoxDelete'] ) {
        echo 
    zen_draw_checkbox_field('cart_delete[]'$product['id']);
      }
    ?>
    </td>
         </tr>
    <?php
      
    // end foreach ($productArray as $product)
    ?>
           <!-- Finished loop through all products /-->
          </table>

    <div id="cartSubTotal"><?php echo SUB_TITLE_SUB_TOTAL?> <?php echo $cartShowTotal?></div>
    <br class="clearBoth" />

    <!--bof shopping cart buttons-->
    <div class="buttonRow forward"><?php echo '<a href="' zen_href_link(FILENAME_CHECKOUT_SHIPPING'''SSL') . '">' zen_image_button(BUTTON_IMAGE_CHECKOUTBUTTON_CHECKOUT_ALT) . '</a>'?></div>
    <div id="cshopping" class="buttonRow back"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_CONTINUE_SHOPPINGBUTTON_CONTINUE_SHOPPING_ALT) . '</a>'?></div>
    <?php
    // show update cart button
      
    if (SHOW_SHOPPING_CART_UPDATE == or SHOW_SHOPPING_CART_UPDATE == 3) {
    ?>
    <div class="buttonRow back"><?php echo zen_image_submit(ICON_IMAGE_UPDATEICON_UPDATE_ALT); ?></div>
    <?php
      
    } else { // don't show update button below cart
    ?>
    <?php
      
    // show update button
    ?>
    <!--eof shopping cart buttons-->
    </form>

    <?php
        
    if (SHOW_SHIPPING_ESTIMATOR_BUTTON == '1') {
    ?>

    <div class="buttonRow back"><?php echo '<a href="javascript:popupWindow(\'' zen_href_link(FILENAME_POPUP_SHIPPING_ESTIMATOR) . '\')">' .
     
    zen_image_button(BUTTON_IMAGE_SHIPPING_ESTIMATORBUTTON_SHIPPING_ESTIMATOR_ALT) . '</a>'?></div>
    <?php
        
    }
    ?>
    <!-- * BEGIN GOOGLE CHECKOUT * -->
     <?php
      
    // ** GOOGLE CHECKOUT **
        
    include(DIR_WS_MODULES 'show_google_components.php');  
      
    // ** END GOOGLE CHECKOUT **
     
    ?>
    <!-- * END GOOGLE CHECKOUT * -->
    <!-- ** BEGIN PAYPAL EXPRESS CHECKOUT ** -->
    <?php  // the tpl_ec_button template only displays EC option if cart contents >0 and value >0
    if (defined('MODULE_PAYMENT_PAYPALWPP_STATUS') && MODULE_PAYMENT_PAYPALWPP_STATUS == 'True') {
      include(
    DIR_FS_CATALOG DIR_WS_MODULES 'payment/paypal/tpl_ec_button.php');
    }
    ?>
    <!-- ** END PAYPAL EXPRESS CHECKOUT ** -->
    <br class="clearBoth" />
    <?php
          
    if (SHOW_SHIPPING_ESTIMATOR_BUTTON == '2') {
    /**
     * load the shipping estimator code if needed
     */
    ?>
          <?php require(DIR_WS_MODULES zen_get_module_directory('shipping_estimator.php')); ?>

    <?php
          
    }
    ?>
    <?php
      
    } else {
    ?>

    <h2 id="cartEmptyText"><?php echo TEXT_CART_EMPTY?></h2>

    <?php
    $show_display_shopping_cart_empty 
    $db->Execute(SQL_SHOW_SHOPPING_CART_EMPTY);

    while (!
    $show_display_shopping_cart_empty->EOF) {
    ?>

    <?php
      
    if ($show_display_shopping_cart_empty->fields['configuration_key'] == 'SHOW_SHOPPING_CART_EMPTY_FEATURED_PRODUCTS') { ?>
    <?php
    /**
     * display the Featured Products Center Box
     */
    ?>
    <?php 
    require($template->get_template_dir('tpl_modules_featured_products.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_featured_products.php'); ?>
    <?php 
    ?>

    <?php
      
    if ($show_display_shopping_cart_empty->fields['configuration_key'] == 'SHOW_SHOPPING_CART_EMPTY_SPECIALS_PRODUCTS') { ?>
    <?php
    /**
     * display the Special Products Center Box
     */
    ?>
    <?php 
    require($template->get_template_dir('tpl_modules_specials_default.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_specials_default.php'); ?>
    <?php 
    ?>

    <?php
      
    if ($show_display_shopping_cart_empty->fields['configuration_key'] == 'SHOW_SHOPPING_CART_EMPTY_NEW_PRODUCTS') { ?>
    <?php
    /**
     * display the New Products Center Box
     */
    ?>
    <?php 
    require($template->get_template_dir('tpl_modules_whats_new.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_whats_new.php'); ?>
    <?php 
    ?>

    <?php
      
    if ($show_display_shopping_cart_empty->fields['configuration_key'] == 'SHOW_SHOPPING_CART_EMPTY_UPCOMING') {
        include(
    DIR_WS_MODULES zen_get_module_directory(FILENAME_UPCOMING_PRODUCTS));
      }
    ?>
    <?php
      $show_display_shopping_cart_empty
    ->MoveNext();
    // !EOF
    ?>
    <?php
      
    }
    ?>
    </div>
    The only time I experience this problem is if I enable shipping estimate to display inline instead of popup.

    Thanks!

 

 

Similar Threads

  1. v150 Shopping Cart / Shipping Estimator
    By SweetEmotions in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 27 Jun 2012, 03:49 AM
  2. Shipping Estimator with Shopping Cart Contents
    By tmdelia in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 22 Jun 2010, 07:52 PM
  3. Shopping cart / Shipping estimator error
    By mr_black in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 16 Jan 2010, 10:48 AM
  4. Displaying shipping estimator inline in shopping cart?
    By onestopgraphicshop in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 27 Mar 2008, 04:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg