News:

Support the VirtueMart project and become a member

Main Menu

VM Multiple Issues & Crashing after upgrade - VM 4.0.2 (10661)

Started by cgerraty, May 16, 2022, 06:00:01 AM

Previous topic - Next topic

cgerraty

Joomla 3.10.9 Stable
VirtueMart 4.0.2 10661
PHP Version    7.4.29

I have multiple issues after the two recent upgrades in the last few days.

1:  The update had cause a complete site crash if I have one of my Shipping modules enabled.  It is the Australian TNT Shipping Module by GJC Webdesign.   It was working perfectly up until the first update about 3 - 4 days ago. IT started with a complete site crash when any user logged in.  I had to go into the admin and manually log the user out for them to be able to VIEW the site again.  I enabled debugging and have attached a screen shot of the error.
GJC have told me that it could be issues with date formats but I have checked and everything is fine. I have not change any configurations to the shipping module or Virtuemart settings.

Right now I have had to disable the main shipping module  - We do not take any payments - our sure is strictly for ORDERS yet  My customers now can not get any shipping costs calculated when they place an order - More work for me on EVERY order placed and now have to manually calculate the shipping quotations for all orders coming in.  What changes could have caused this ?  ???

2: In the administration I click on products and it brings up all the products. If I filter by MANUFACTURER I have one or two manufacturers that will display NO products in the list.    The Products are there in the show ALL (no filters), and the products in question are all linked to that manufacturer and should show up..... This only occurred AFTER the upgrade !  Does it require some sort of re-indexing of the product database?  Are there any other stuff-ups that I am going to come across ?  It seems that there are a couple of erros when filtering the product list.


3:  Incorrect Stock Level information on Category view:    Before the upgrade  I had  modified the com_virtuemart >sublayouts >products.php file to show the actual stock level instead of the silly no/low/high stock level indicator for any user that was logged in.  The code inserted is below:
---------------------- --------------------
<?php
  $user 
JFactory::getUser();
  if(
$user->guest) { ?>

      Please log in for stock availability
   <?php }
    else { 
?>

      <?php ?>
         <div>
           <p>Stock Availability: <b>
            <?php
            if (($product->product_in_stock $product->product_ordered) > "0" ) {
                echo $product->product_in_stock $product->product_ordered; }
                else {
                    echo 'Call For Stock';
                }
            ?>

            </b></p>
         </div>
      <?php ?>
   <?php  };
?>


-------------------- [END CODE] ----------------------------------

As you can see if the user is NOT logged in it shows "Please log in for stock availability". IF they ARE logged in it will display "Stock Availability: " and then the stock level in a numerical format.   if the stock level is less than one it will display "Call for Stock"

The issue I have is that now it is showing the correct stock level for SOME items and it is showing "Call for Stock" for other items even though there is stock available.  It was working PERFECTLY before the recent upgrades.

The user can click on the PRODUCT DETAILS and it shows up with the Correct product quantity.... but when they click on the category and it lists the products it doesn't work !

What has changed is these latest updates that will cause this issue ?  Do I need to tweak my code above to display the stock level on all positive stock ?


Any help or advice is welcome.... I would really like to get things working again.

pinochico

QuoteMy customers now can not get any shipping costs calculated when they place an order

Upgrade on a production site instead of testing on a development site?
Every good developer knows that's the wrong way to go.
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

Jörgen

Stock greater than "0", a string! ?

I would make an integer calculation, the current one is a risky construct.

You should also really update the template sublayout file instead of the actual sublayout file.

Jörgen

Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

cgerraty

I am no PHP expert,   if there is a better way to do it I am all ears.     As for the stock greater than 0 I was just tweaking as it was "1" but then it wasn't showing any stock that only had 1 left.  Can I put a = or > statement in there ?


Quote from: Jörgen on May 16, 2022, 08:25:11 AM
Stock greater than "0", a string! ?

I would make an integer calculation, the current one is a risky construct.

You should also really update the template sublayout file instead of the actual sublayout file.

Jörgen



cgerraty

Thank you for your most thoughtful input and opinion on my situation..... you have been most helpful.

Quote from: pinochico on May 16, 2022, 07:49:48 AM
QuoteMy customers now can not get any shipping costs calculated when they place an order

Upgrade on a production site instead of testing on a development site?
Every good developer knows that's the wrong way to go.

As a developer I thought you may have at least provided  some sort of solution...

Jörgen

This would be better:


if (((int)$product->product_in_stock - (int)$product->product_ordered) > 0 ) {
                echo $product->product_in_stock - $product->product_ordered; }
                else {
                    echo 'Call For Stock';


Your override goes here:

/templates/your_template/html/com_virtuemart/sublayouts/products.php

You may have to make small changes when VM gets updated, but your code is untouched there :)

Jörgen
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.