VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: pimo on May 26, 2023, 16:59:50 PM

Title: Create a new shipping method gives an error
Post by: pimo on May 26, 2023, 16:59:50 PM
Joomla 4.3.1 and Virtuemart 4.0.2, PHP 7.4 (If I put PHP 8 or higher I have problems editing products). When trying to create a new shipping method I get 2 errors:

vmError: vmTable store insertObject #__virtuemart_shipmentmethods Field 'slug' doesn't have a default value INSERT INTO `xz3sd_virtuemart_shipmentmethods` (`virtuemart_shipmentmethod_id`,`virtuemart_vendor_id`,`shipment_jplugin_id`,`shipment_element`,`currency_id`,`shipment_params`,`ordering`,`shared`,`published`,`created_on`,`created_by`,`locked_by`) VALUES ('0','1','10018','weight_countries','47','shipment_logos=\"\"|show_on_pdetails=\"\"|zip_start=\"\"|zip_stop=\"\"|weight_start=\"\"|weight_stop=\"\"|weight_unit=\"\"|nbproducts_start=0|nbproducts_stop=0|shipment_cost=0.0|package_fee=0.0|tax_id=\"\"|free_shipment=\"\"|categories=\"\"|blocking_categories=\"\"|countries=\"\"|blocking_countries=\"\"|min_amount=0.0|max_amount=0.0|virtuemart_shipmentmethod_ids=\"\"|byCoupon=\"\"|couponCode=\"\"|display_color=\"\"|','0','0','1','2023-05-26 13:56:48','1588','0')
vmError: vmTable store insertObject #__virtuemart_shipmentmethods_es_es Duplicate entry '0' for key 'PRIMARY' INSERT INTO `xz3sd_virtuemart_shipmentmethods_es_es` (`virtuemart_shipmentmethod_id`,`shipment_name`,`shipment_desc`,`slug`) VALUES ('0','prueb 33','','prueb-33')
Title: Re: Create a new shipping method gives an error
Post by: Margriet on May 30, 2023, 11:29:15 AM
Unable to reproduce. Just created 3 new shipment methods last week. Must be something in your installation.
Try with clean Joomla install with VM and sample data and Cassiopeia template (template shouldn't do much, but just to make sure).
Title: Re: Create a new shipping method gives an error
Post by: pimo on May 31, 2023, 10:14:57 AM
Good morning, everything was working fine before, at what point it started to fail I don't know. In this post it shows the same error and the solution:

https://forum.virtuemart.net/index.php?topic=148798.0

I have not tried yet, I have many doubts. But I have always updated all Virtuemart versions when the warning has come out in Joomla, so this version that is specified must have been installed.
  Since the membership was installed, no update notifications have been received for Virtuemart. I installed version 4.0.20 because I saw that it was available in a forum. So I wonder if any previous update has been skipped? In fact I have read in another psot that version 4.0.22 is available, but I don't see it.
I think the Virtuemart updates are not working as they should.

Making a new page will fix the problem, but it is not the solution. There are plenty of products, shipping methods, and other things already set up to do all that work. They should not recommend this to anyone, rather they should look for the problem and the solution.
I'm not sure what the casiopeia template has to do with the backend, I don't think that solves anything. In any case, you are using Cassiopeia in the front.
Title: Re: Create a new shipping method gives an error
Post by: pimo on May 31, 2023, 14:59:22 PM
I have tried to install version 4.0.7 indicated in the post attached above, but I still have the same problem.
Title: Re: Create a new shipping method gives an error
Post by: Jörgen on May 31, 2023, 18:03:21 PM
Do you have any payment or shipping plugins that you do not use?
If so unpublish the plugins in through Joomla.
Jörgen @ Kreativ Fotografi
Title: Re: Create a new shipping method gives an error
Post by: pimo on June 01, 2023, 17:42:30 PM
Hello, several years ago I minimize the use of plugins or anything else.
There are enough problems with only Joomla and Visrtuemart to look for more.....
Title: Re: Create a new shipping method gives an error
Post by: Margriet on June 01, 2023, 18:40:30 PM
QuoteI have tried to install version 4.0.7 indicated in the post attached above, but I still have the same problem.
Always use the latest version. Membership version 4.0.20 and free version 4.0.12!
Title: Re: Create a new shipping method gives an error
Post by: pimo on June 02, 2023, 14:13:19 PM
Hello Margarit, if you read the first message of this post, you will see that version 4.0.20 was installed with membership.

So I don't understand this problem and others, like the one in PHP 8. I read in many posts that these things are solved, but I still have the same problems. So I'm not sure the updates are working well.
Title: Re: Create a new shipping method gives an error
Post by: Margriet on June 02, 2023, 14:54:12 PM
Sorry, but in your first post you've written
QuoteVirtuemart 4.0.2,
, so how am I supposed to know that you're having version 4.0.20?
And it strikes me that you do seem to have a lot of problems with VM, which are not reproducible by anyone and/or have long been solved. The cause could also lie with your settings or your hoster.
Title: Re: Create a new shipping method gives an error
Post by: pimo on June 02, 2023, 15:48:09 PM
I have read the same problems that I have in this forum. They don't just happen to me. The hosting has always been the same, for more than 14 years, its configuration has not changed and it has always worked well.
The updates are made, but the problems persist.
I've also looked at template overrides, but I don't see any that have to do with these problems.

That question that you ask yourself, I ask myself, how is it possible that the problems are fixed but I continue with them?
The PHP problem has something to do with the language files, I don't remember exactly what it was, but something that the new version of PHP didn't understand, a ? or some symbol like that. In fact, there is a language file in English to download in the membership, but the installation also gives me a problem.

So I still think there is a problem with the updates.
Title: Re: Create a new shipping method gives an error
Post by: pimo on June 06, 2023, 10:49:40 AM
Good morning, not having any news about this problem makes me nervous, at least an answer if it has been seen that it is a problem in Virtuemart or if it is just my problem. I understand that many of the problems that are exposed in the forum are being fixed and I am waiting for the next update, but an answer would be nice.

I would like to check the folders for the files that have to do with shipping methods, to rule out other problems. Can someone tell me which folders they are in?
Title: Re: Create a new shipping method gives an error
Post by: Margriet on June 06, 2023, 11:16:43 AM
There is something wrong with your database. Have you tried to repair your tables?
vmError: vmTable store insertObject #__virtuemart_shipmentmethods_es_es Duplicate entry '0' for key 'PRIMARY' INSERT INTO `xz3sd_virtuemart_shipmentmethods_es_es` (`virtuemart_shipmentmethod_id`,`shipment_name`,`shipment_desc`,`slug`) VALUES ('0','prueb 33','','prueb-33')
virtuemart_shipmentmethod_id can't be 0
Title: Re: Create a new shipping method gives an error
Post by: pimo on June 06, 2023, 11:32:45 AM
The tables are not updated, it is another of the errors that are pending, I indicated it in the post that you have put about it.
I have seen that someone has found a solution, I don't know whether to try it or wait for the next update.
Title: Re: Create a new shipping method gives an error
Post by: Margriet on June 06, 2023, 11:46:09 AM
What you want. Personally I would apply the fix.
Title: Re: Create a new shipping method gives an error
Post by: pimo on June 06, 2023, 12:12:27 PM
I have tried the solution to install and update tables. That fixes the tables problem, but my problem persists in creating a new shipping method.
Title: Re: Create a new shipping method gives an error
Post by: pimo on June 06, 2023, 12:24:29 PM
I only find this file for shipping methods, could someone check if there is something different from your file?. administrator/components/com_virtuemart/tables

<?php

/**
*
* Shipment  table
*
* @package   VirtueMart
* @subpackage Shipment
* @author RickG
* @link https://virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* @version $Id: shipmentcarriesr.php -1   $
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

/**
* Shipment  table class
* The class is is used to manage the shipment in the shop.
*
* @package   VirtueMart
* @author RickG, Max Milbers
*/
class TableShipmentmethods extends VmTable {

    /** @var int Primary key */
    var $virtuemart_shipmentmethod_id = 0;

    /** @var int Vendor ID */
    var $virtuemart_vendor_id = 0;

    /** @var int Shipment Joomla plugin I */
    var $shipment_jplugin_id = 0;

    /** @var string Shipment  name */
    var $shipment_name = '';

    /** @var string Shipment  name */
    var $shipment_desc = '';
    var $slug;
    /** @var string Element of shipmentmethod */
    var $shipment_element = '';

    var $currency_id = 0;

    /** @var string parameter of the shipmentmethod */
    var $shipment_params = 0;

    var $ordering = 0;
    var $shared = 0;

    /** @var int published boolean */
    var $published = 1;

    /**
     * @author Max Milbers
     * @param JDataBase $db
     */
    function __construct(&$db) {
      parent::__construct('#__virtuemart_shipmentmethods', 'virtuemart_shipmentmethod_id', $db);
      // we can have several time the same shipment name. It is the vendor problem to set up correctly his shipment rate.
      // $this->setUniqueName('shipment_name');
      $this->setObligatoryKeys('shipment_jplugin_id');
      $this->setObligatoryKeys('shipment_name');
      $this->setLoggable();
       $this->setLockable();
      $this->setTranslatable(array('shipment_name', 'shipment_desc'));
      $this->setSlug('shipment_name');
      $this->setTableShortCut('shipm');

      $varsToPushParam = array('display_color' => array('','char'));

      $this->setParameterable('shipment_params',$varsToPushParam);

    }


}

// pure php no closing tag
Title: Re: Create a new shipping method gives an error
Post by: Margriet on June 06, 2023, 13:04:27 PM
You have a problem with your tables, not with your files. If you can, install only Joomla and VM with sample data in a subfolder with a new database and check if you have the same problem(s).
Title: Re: Create a new shipping method gives an error
Post by: pimo on June 06, 2023, 13:13:05 PM
 I don't know, I'm not a programmer, but the slug is one of the problems and I see that it is different from the rest of the variables: 

var $slug;

while all other variables are different, for example the line above:

var $shipment_desc = '';
Title: Re: Create a new shipping method gives an error
Post by: Margriet on June 06, 2023, 14:30:30 PM
Please read carefully: You have a problem with your tables, not with your files!!!
So check your database!
Title: Re: Create a new shipping method gives an error
Post by: pimo on June 07, 2023, 09:49:21 AM
Where can I see how the database should be configured? I see my database, but I don't know if it's correct.
Title: Re: Create a new shipping method gives an error
Post by: pimo on July 12, 2023, 09:26:49 AM
the problem is still in 4.0.22.
Title: Re: Create a new shipping method gives an error
Post by: Margriet on July 12, 2023, 09:38:12 AM
QuoteYou have a problem with your tables, not with your files. If you can, install only Joomla and VM with sample data in a subfolder with a new database and check if you have the same problem(s).
As you are the only one having this problem, please debug following the advice I gave you earlier.
Title: Re: Create a new shipping method gives an error
Post by: pimo on July 12, 2023, 11:54:30 AM
I don't know how to solve this problem, if you know tell me how to fix it. This problem has been made in some Virtuemart update, not created by me.
Title: Re: Create a new shipping method gives an error
Post by: pimo on July 12, 2023, 17:38:35 PM
Quote from: Margriet on July 12, 2023, 09:38:12 AM
QuoteYou have a problem with your tables, not with your files. If you can, install only Joomla and VM with sample data in a subfolder with a new database and check if you have the same problem(s).
As you are the only one having this problem, please debug following the advice I gave you earlier.

I put a link of a post in which the same problem is explained and it is said that it has been fixed in the next version. So I don't think it's just my mistake.
This was working fine. Also there are more problems in the database with other features, like adding the products of an order (add a new product to the order), it also gives database problems.