Update 1.0.9.6 to 1.0.9.7

Open to all! Ask other shopowners for help.
Scratchilito
Member
Posts: 37
Joined: Wed Jan 26, 2022 2:15 pm
Phoenix Version: v1.1.0.6
Has thanked: 6 times

Update 1.0.9.6 to 1.0.9.7

Post by Scratchilito »

Hello,
I recently upgraded my local version (not the 1.0.9.6 in prod who works fine) 1.0.9.6 to 1.0.9.7 using the provided package. (SQL, files, pi_qty_input but not gdpr).
Here's what I get when I click on the "shopping cart":

Fatal error: Uncaught Error: Undefined constant "SMALL_IMAGE_WIDTH" in \templates\override\includes\modules\content\shopping_cart\tpl_cm_sc_product_listing.php:19

Code: Select all

Fatal error: Uncaught Error: Undefined constant "SMALL_IMAGE_WIDTH" in \templates\override\includes\modules\content\shopping_cart\tpl_cm_sc_product_listing.php:19

Stack trace: 

#0 \includes\modules\content\cm_template.php(14): include() 
#1 \includes\modules\content\shopping_cart\cm_sc_product_listing.php(46): include('D:\\xampp\\htdocs...') 
#2 \includes\system\versioned\1.0.8.4\template.php(106): cm_sc_product_listing->execute() 
#3 \templates\default\includes\pages\shopping_cart.php(13): Template->get_content('shopping_cart') 
#4 \shopping_cart.php(17): require('D:\\xampp\\htdocs...') 
#5 {main} thrown in \templates\override\includes\modules\content\shopping_cart\tpl_cm_sc_product_listing.php on line 19
Clicking on "checkout" works well, but it's still not enough to use the store.

I use xampp windows_8.30
In phoenixcart, I also use Ajax attribute manager and pi-QTPRO

Who can help me make the necessary corrections? Thank you in advance.


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Update 1.0.9.6 to 1.0.9.7

Post by burt »

You are using the /override/ template in which you have overridden the tpl_cm_sc_product_listing.php file.

You have two options;

1. delete that file
OR
2. make changes in that file to make it more like the core version
https://github.com/CE-PhoenixCart/Phoen ... isting.php and the precise change you need to make [ https://github.com/CE-PhoenixCart/Phoen ... c159e488bd ]
I am not here to build for you.
I am here to build with you. Let's help each other.
Scratchilito
Member
Posts: 37
Joined: Wed Jan 26, 2022 2:15 pm
Phoenix Version: v1.1.0.6
Has thanked: 6 times

Re: Update 1.0.9.6 to 1.0.9.7

Post by Scratchilito »

Thank You very much Burt,

Option 1 :
I renamed the file (so as not to delete it too quickly) and indeed, I found my basket. :+1: :+1: :+1:

Editing tpl_cm_sc_product_listing.php, I realize that at the end of the file, it's a QTpro element.
I've just checked, and QTpro is currently compatible with version 1.0.9.4. I wish that the update will arrive.

Option 2:
Perhaps your skills can detect the temporary modification to be applied to this file while waiting for the update?
(I can understand what's being explained to me but, alas, I'm not a developer).

Code: Select all

<div class="<?= MODULE_CONTENT_SC_PRODUCT_LISTING_CONTENT_WIDTH ?> cm-sc-product-listing">
  <?= $form ?>
  <div class="table-responsive">
    <table class="table mb-0">
      <thead class="thead-light">
        <tr>
          <th class="d-none d-md-table-cell">&nbsp;</th>
          <th><?= MODULE_CONTENT_SC_PRODUCT_LISTING_HEADING_PRODUCT ?></th>
          <th><?= MODULE_CONTENT_SC_PRODUCT_LISTING_HEADING_AVAILABILITY ?></th>
          <th><?= MODULE_CONTENT_SC_PRODUCT_LISTING_HEADING_QUANTITY ?></th>
          <th class="text-right"><?= MODULE_CONTENT_SC_PRODUCT_LISTING_HEADING_PRICE ?></th>
        </tr>
      </thead>
      <tbody>
        <?php
  foreach ($products as $product) {
    echo '<tr>';
    echo '<td class="d-none d-md-table-cell"><a href="', $product->get('link'), '">',
         new Image('images/' . $product->get('image'), [], htmlspecialchars($product->get('name')), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT),
         '</a></td>';
    echo '<th><a href="', $product->get('link'), '">', $product->get('name'), '</a>';
    $attributes = $product->get('attributes');
    foreach (($product->get('attribute_selections') ?? []) as $option => $value) {
      echo '<small><br><i> - ', $attributes[$option]['name'], ' ', $attributes[$option]['values'][$value]['name'], '</i></small>';
    }
    echo '</th>';

// QtPro BEGIN
    if (STOCK_CHECK == 'true') {
      if ( $product->get('has_attributes') ) {
        $stock_check = $GLOBALS['hook_shop_siteWide_qtPro']->check_stock_qtpro($product);
      } else {
        $stock_check = $product->lacks_stock();
      }
      if ($stock_check) {
        $GLOBALS['any_out_of_stock'] = true;

        echo '<td><span class="text-danger"><b>' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '</b></span></td>';
      } else {
        echo '<td>' . MODULE_CONTENT_SC_PRODUCT_LISTING_TEXT_IN_STOCK . '</td>';
      }
    } else {
      echo '<td>' . MODULE_CONTENT_SC_PRODUCT_LISTING_TEXT_IN_STOCK . '</td>';
    }
  // QtPro END

    echo '<td>';
    echo '<div class="input-group">';
    echo new Input('cart_quantity[]', ['value' => $product->get('quantity'), 'style' => 'width: 65px;', 'min' => '0'], 'number');
    echo new Input('products_id[]', ['value' => $product->get('uprid')], 'hidden');
    echo '<div class="input-group-append">', new Button(MODULE_CONTENT_SC_PRODUCT_LISTING_TEXT_BUTTON_UPDATE, '', 'btn-info'), '</div>';
    echo '<div class="input-group-append">',
         new Button(MODULE_CONTENT_SC_PRODUCT_LISTING_TEXT_BUTTON_REMOVE, '', 'btn-danger', [], $GLOBALS['Linker']->build('shopping_cart.php', ['action' => 'remove_product', 'products_id' => $product->get('uprid')])),
         '</div>';
    echo '</div>';
    echo '</td>';
    echo '<td class="text-right">', $product->format('final_price', $product->get('quantity')), '</td>';
    echo '</tr>';
  }
?>
      </tbody>
    </table>
  </div>
  </form>
  <hr class="mt-0">
</div>	

<?php
/*
  $Id$

  QTpro
  Version 7.4.0 Phoenix

  by @raiwa
  info@oscaddons.com
  www.oscaddons.com

  Copyright (c) 2021 Rainer Schmied

  CE Phoenix, E-Commerce made Easy
  https://phoenixcart.org

  Copyright (c) 2021 Phoenix Cart

  Released under the GNU General Public License
*/
Thank you again.
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Update 1.0.9.6 to 1.0.9.7

Post by burt »

https://github.com/CE-PhoenixCart/Phoen ... c159e488bd

should illuminate the problem in your overridden file.
Minor change in two lines;

Code: Select all

echo '<td class="d-none d-md-table-cell">';
  echo '<a href="', $product->get('link'), '">', new Image('images/' . $product->get('image'), [], htmlspecialchars($product->get('name')), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT), '</a>';
to

Code: Select all

echo '<td class="d-none d-md-table-cell" style="width: 200px;">';
  echo '<a href="', $product->get('link'), '">', new Image('images/' . $product->get('image'), [], htmlspecialchars($product->get('name'))), '</a>';
I am not here to build for you.
I am here to build with you. Let's help each other.
Scratchilito
Member
Posts: 37
Joined: Wed Jan 26, 2022 2:15 pm
Phoenix Version: v1.1.0.6
Has thanked: 6 times

Re: Update 1.0.9.6 to 1.0.9.7

Post by Scratchilito »

Great !!!
In my case, there's just a tiny adjustment at the end of the line: (/a and /td).

Code: Select all

echo '<td class="d-none d-md-table-cell" style="width: 200px;">';
echo '<a href="', $product->get('link'), '">', new Image('images/' . $product->get('image'), [], htmlspecialchars($product->get('name'))), 
'</a></td>';
Thank you very much!
Scratchilito
Member
Posts: 37
Joined: Wed Jan 26, 2022 2:15 pm
Phoenix Version: v1.1.0.6
Has thanked: 6 times

Re: Update 1.0.9.6 to 1.0.9.7

Post by Scratchilito »

The joy was short-lived. Full of confidence about going online, I did my global update on the web.

I found myself with exactly the same error as before.

I was able to :

- Use the modified file, which works fine locally (option 1).
- Use the original github file modified for qtpro (option 2).
- Use the original unmodified github file.
- Delete the templates/override/etc. file.

Still the same fatal error. I'm stuck.

---
Currently (and it doesn't work), I'm using option 2 with the original github file to which I've made the following changes:

Replacement of lines 35 to 41 :

Code: Select all

    if (STOCK_CHECK == 'true' && $product->lacks_stock()) {
              $GLOBALS['any_out_of_stock'] = true;

              echo '<td class="d-none d-md-table-cell align-middle"><span class="text-danger">' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '</span></td>';
            } else {
              echo '<td class="d-none d-md-table-cell align-middle">' . MODULE_CONTENT_SC_PRODUCT_LISTING_TEXT_IN_STOCK . '</td>';
            }
By the possibly outdated modification of qtpro :

Code: Select all

// QtPro BEGIN
    if (STOCK_CHECK == 'true') {
      if ( $product->get('has_attributes') ) {
        $stock_check = $GLOBALS['hook_shop_siteWide_qtPro']->check_stock_qtpro($product);
      } else {
        $stock_check = $product->lacks_stock();
      }
      if ($stock_check) {
        $GLOBALS['any_out_of_stock'] = true;

        echo '<td><span class="text-danger"><b>' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '</b></span></td>';
      } else {
        echo '<td>' . MODULE_CONTENT_SC_PRODUCT_LISTING_TEXT_IN_STOCK . '</td>';
      }
    } else {
      echo '<td>' . MODULE_CONTENT_SC_PRODUCT_LISTING_TEXT_IN_STOCK . '</td>';
    }
  // QtPro END	
When Raiwa returns, perhaps he'll be able to take over, but in the meantime you might have seen the obvious.
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Update 1.0.9.6 to 1.0.9.7

Post by burt »

Without knowing the exact error...it's not possible to give meaningful help.
What does your hosting error_log say?
I am not here to build for you.
I am here to build with you. Let's help each other.
Scratchilito
Member
Posts: 37
Joined: Wed Jan 26, 2022 2:15 pm
Phoenix Version: v1.1.0.6
Has thanked: 6 times

Re: Update 1.0.9.6 to 1.0.9.7

Post by Scratchilito »

burt wrote: Wed Oct 02, 2024 2:11 pm Without knowing the exact error...it's not possible to give meaningful help.
What does your hosting error_log say?
Sorry, it's because it's the same error as this morning on the locally version (which it now operates :D ):

Code: Select all

Fatal error: Uncaught Error: Undefined constant "SMALL_IMAGE_WIDTH" in ./templates/override/includes/modules/content/shopping_cart/tpl_cm_sc_product_listing.php:19 

Stack trace: 
#0 ./includes/modules/content/cm_template.php(14): include() 
#1 ./includes/modules/content/shopping_cart/cm_sc_product_listing.php(46): include('/datas/yulpa174...') 
#2 ./includes/system/versioned/1.0.8.4/template.php(106): cm_sc_product_listing->execute() 
#3 ./templates/default/includes/pages/shopping_cart.php(13): Template->get_content('shopping_cart') 
#4 ./shopping_cart.php(17): require('/datas/yulpa174...') 
#5 {main} thrown in ./templates/override/includes/modules/content/shopping_cart/tpl_cm_sc_product_listing.php on line 19
The only difference is that this notification block is a link that takes you back to the purchased item when you click on it.
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Update 1.0.9.6 to 1.0.9.7

Post by burt »

To fix it, perform same action you did this morning. It is telling you the exact problem;

Fatal error: Uncaught Error: Undefined constant "SMALL_IMAGE_WIDTH" in ./templates/override/includes/modules/content/shopping_cart/tpl_cm_sc_product_listing.php:19

On Line 19 of this file you have SMALL_IMAGE_WIDTH. Change Line 19 appropriately.
I am not here to build for you.
I am here to build with you. Let's help each other.
Scratchilito
Member
Posts: 37
Joined: Wed Jan 26, 2022 2:15 pm
Phoenix Version: v1.1.0.6
Has thanked: 6 times

Re: Update 1.0.9.6 to 1.0.9.7

Post by Scratchilito »

Thank you for your time.

I've been applying your advices all the day and I've come to the conclusion that there's a server-side cache problem, because I've refreshed my browsers, changed computers and here's what's crazy:

1) I've deleted the file and I still get the error on line 19 even though the file no longer exists.

2) Then when I put back the corrected file (which works locally) I still get this error on line 19, whereas the correction puts this line in position 20.

So I'll do it again tomorrow, and hope there'll be an emptying tonight.

Here are the first 34 lines to see that the '19' is a simple "echo '<tr>'.

Code: Select all

<div class="<?= MODULE_CONTENT_SC_PRODUCT_LISTING_CONTENT_WIDTH ?> cm-sc-product-listing">
  <?= $form ?>
  <div class="table-responsive">
    <table class="table table-sm table-hover mb-0">
      <thead class="thead-light">
        <tr>
          <th scope="col" class="d-none d-md-table-cell">&nbsp;</th>
          <th scope="col"><?= MODULE_CONTENT_SC_PRODUCT_LISTING_HEADING_PRODUCT ?></th>
          <th scope="col" class="d-none d-md-table-cell"><?= MODULE_CONTENT_SC_PRODUCT_LISTING_HEADING_AVAILABILITY ?></th>
          <th scope="col"><?= MODULE_CONTENT_SC_PRODUCT_LISTING_HEADING_QUANTITY ?></th>
          <th scope="col" class="text-right"><?= MODULE_CONTENT_SC_PRODUCT_LISTING_HEADING_PRICE ?></th>
          <th scope="col">&nbsp;</th>
        </tr>
      </thead>
      <tbody>
        <?php
        foreach ($products as $product) {
          echo new Input('products_id[]', ['value' => $product->get('uprid')], 'hidden');
          echo '<tr>';
            echo '<td scope="row" class="d-none d-md-table-cell" style="width: 200px;">';
            echo '<a href="', $product->get('link'), '">', new Image('images/' . $product->get('image'), [], htmlspecialchars($product->get('name'))), '</a>';
            echo '</td>';
            echo '<th class="align-middle">';
              echo '<a href="', $product->get('link'), '">', $product->get('name'), '</a>';
              if (STOCK_CHECK == 'true' && $product->lacks_stock()) {
                $GLOBALS['any_out_of_stock'] = true;

                echo '<span class="d-md-none text-danger align-middle">' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '</span>';
              } 
              $attributes = $product->get('attributes');
              foreach (($product->get('attribute_selections') ?? []) as $option => $value) {
                echo '<small><br><i> - ', $attributes[$option]['name'], ' ', $attributes[$option]['values'][$value]['name'], '</i></small>';
              }
            echo '</th>';
Thank you for your patience.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply