Results 1 to 10 of 13

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,915
    Plugin Contributions
    13

    Default Re: Error when installing the shipping surcharge module

    @mc12345678 you are wrong.

    the keys method is not the place to install configuration values. if one were to add the global $db declaration in said method, what happens when we call the install method, and we try to execute lines 127 and 128? we would now have an attempt to insert a duplicate key into the configuration table. (i can't remember which method gets called first, the result is the same.)

    i would encourage you to test your recommendations (as i did) prior to making them. adding the global $db declaration just causes a new error. and, to me, it's pretty clear where the config values should get installed.... in the install method.

    this is the answer and the best help for the OPs issue.
    Last edited by carlwhat; 14 Mar 2022 at 12:57 AM.
    author of square Webpay.
    mxWorks now has Apple Pay and Google Pay. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  2. #2
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: Error when installing the shipping surcharge module

    Quote Originally Posted by carlwhat View Post
    @mc12345678 you are wrong.

    the keys method is not the place to install configuration values. if one were to add the global $db declaration in said method, what happens when we call the install method, and we try to execute lines 127 and 128? we would now have an attempt to insert a duplicate key into the configuration table. (i can't remember which method gets called first, the result is the same.)

    i would encourage you to test your recommendations (as i did) prior to making them. adding the global $db declaration just causes a new error. and, to me, it's pretty clear where the config values should get installed.... in the install method.

    this is the answer and the best help for the OPs issue.
    And apparently you missed the memo. Ways of installing/upgrading are to not require removal in order to upgrade. Been that way for a few zen Cart versions. Not sure what type of purist you are, but the keys method is out of the way of routine operation as once the missing keys are present there's no need to check again.

    So looks like with that added information about the additional install issue that the query for the two newly added keys within the related install method should each start with insert ignore.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,536
    Plugin Contributions
    127

    Default Re: Error when installing the shipping surcharge module

    A couple of flubs on my part - as noted above, the $db variable needs to be global'ed but also the INSERT in keys() - which saves a remove/reinstall for upgraders - should *only* be done if the module is already installed. This provides an easier path for users to update plugins which might have new configuration keys. See (for example) authorizenet.php line 525.

    Will update this module shortly.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

 

 

Similar Threads

  1. Replies: 16
    Last Post: 28 Sep 2020, 02:18 AM
  2. Add a flat surcharge into cart when using USPS module?
    By stride-r in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 9 Dec 2008, 02:57 AM
  3. Installing shipping module causes headers already sent error
    By swguy in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 22 Dec 2007, 06:19 PM
  4. Error installing cloned zone shipping module
    By shocker in forum Built-in Shipping and Payment Modules
    Replies: 11
    Last Post: 16 Aug 2007, 04:15 AM
  5. Canada Post shipping module - Fuel Surcharge
    By jbrit in forum Addon Shipping Modules
    Replies: 0
    Last Post: 4 Aug 2006, 05:36 AM

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