Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2019
    Location
    Sweden
    Posts
    6
    Plugin Contributions
    0

    Default Digital download setup - error after checkout

    Hi all! I really need help with this

    I did a fresh install of ZenCart v. 1.5.6c with responsive classic default theme and are trying to set up digital products to download.

    If I follow Zencart tutorial for digital download I end up with this error after payment is completed:
    WARNING: An Error occurred, please refresh the page and try again.

    BUT: If I add one more attribute to my product it works -
    It also works fine with checkout if I add an additional product with two attributes option to my cart and checkout, then the download works fine and the error doesn't appear.

    But I only want ONE option and not two radiobuttons. I can't solve this! BUG or configuration errors?


    Error log shows:
    [04-Aug-2019 19:30:06 UTC] Request URI: /index.php?main_page=checkout_process, IP address: 90.227.242.86
    #1 trigger_error() called at [/home/xenbwyun/public_html/yourownfont.com/includes/classes/db/mysql/query_factory.php:171]
    #2 queryFactory->show_error() called at [/home/xenbwyun/public_html/yourownfont.com/includes/classes/db/mysql/query_factory.php:143]
    #3 queryFactory->set_error() called at [/home/xenbwyun/public_html/yourownfont.com/includes/classes/db/mysql/query_factory.php:270]
    #4 queryFactory->Execute() called at [/home/xenbwyun/public_html/yourownfont.com/includes/functions/functions_general.php:952]
    #5 zen_db_perform() called at [/home/xenbwyun/public_html/yourownfont.com/includes/classes/order.php:695]
    #6 order->create() called at [/home/xenbwyun/public_html/yourownfont.com/includes/modules/checkout_process.php:95]
    #7 require(/home/xenbwyun/public_html/yourownfont.com/includes/modules/checkout_process.php) called at [/home/xenbwyun/public_html/yourownfont.com/includes/modules/pages/checkout_process/header_php.php:14]
    #8 require(/home/xenbwyun/public_html/yourownfont.com/includes/modules/pages/checkout_process/header_php.php) called at [/home/xenbwyun/public_html/yourownfont.com/index.php:36]
    --> PHP Fatal error: 1366:Incorrect integer value: '' for column `xenbwyun_zencart`.`orders`.`delivery_address_format_id` at row 1 :: INSERT INTO orders (customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, payment_module_code, shipping_method, shipping_module_code, coupon_code, cc_type, cc_owner, cc_number, cc_expires, date_purchased, orders_status, order_total, order_tax, currency, currency_value, ip_address) VALUES ('4', 'test buyer', '', 'fdfdfdfd', '', 'sydney', '77777', 'Australian Capital Territory', 'Australia', '4636472364', '[email protected]', '7', ' ', '', '', '', '', '', '', '', '', 'test buyer', '', 'fdfdfdfd', '', 'sydney', '77777', 'Australian Capital Territory', 'Australia', '7', 'PayPal', 'paypalwpp', 'Free Shipping', 'free', '', '', '', '', '', now(), '2', '3', '0', 'USD', '1.000000', '90.227.242.86 - 90.227.242.86') ==> (as called by) /home/xenbwyun/public_html/yourownfont.com/includes/functions/functions_general.php on line 952 <== in /home/xenbwyun/public_html/yourownfont.com/includes/classes/db/mysql/query_factory.php on line 171.
    Thanks in advance for any help!

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

    Default Re: Digital download setup - error after checkout

    So the "quick" fix (meaning I don't think it really resolves the why this is an issue) is to modify includes/classes/order.php

    At lines 658, 667, and 676
    Insert/force conversion to an integer by use of (int).

    Like so where applicable:
    Code:
    (int)$this->billing['format_id'],
    Code:
    (int)$this->customer['format_id'],
    Code:
    (int)$this->shipping['format_id'],
    While I haven't yet attempted to reproduce the issue, I was curious if the payment method had anything to do with it as it appears that the format_id was set to 0 though it did not translate properly to an integer just as an empty value and yet earlier in processing/data collection within the class it appears that such a value is assigned an integer making it seem like it doesn't need to be so assigned in the lines above... but if something else adjusted the associated assignments, it would be good to know. Though perhaps it was a lack of assignment is why it didn't get set to a zero.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Jul 2019
    Location
    Sweden
    Posts
    6
    Plugin Contributions
    0

    Default Re: Digital download setup - error after checkout

    Quote Originally Posted by mc12345678 View Post
    So the "quick" fix (meaning I don't think it really resolves the why this is an issue) is to modify includes/classes/order.php

    At lines 658, 667, and 676
    Insert/force conversion to an integer by use of (int).

    Like so where applicable:
    Code:
    (int)$this->billing['format_id'],
    Code:
    (int)$this->customer['format_id'],
    Code:
    (int)$this->shipping['format_id'],
    While I haven't yet attempted to reproduce the issue, I was curious if the payment method had anything to do with it as it appears that the format_id was set to 0 though it did not translate properly to an integer just as an empty value and yet earlier in processing/data collection within the class it appears that such a value is assigned an integer making it seem like it doesn't need to be so assigned in the lines above... but if something else adjusted the associated assignments, it would be good to know. Though perhaps it was a lack of assignment is why it didn't get set to a zero.
    I tried inserting (int) but it didn't fix the issue, I will just have to live with the two attributes setting.... Or install the old version I used to have.... But if anyone have a solution I'm willing to try :) But it's time to get working now!

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,683
    Plugin Contributions
    123

    Default Re: Digital download setup - error after checkout

    There appears to be an issue in 1.5.6 where for downloadable products which don't require a shipping address, this can happen.
    The solution should be to change includes/classes/order.php line 667 from

    'delivery_address_format_id' => $this->delivery['format_id'],

    to

    'delivery_address_format_id' => (int)$this->delivery['format_id'],
    That Software Guy. My Store: Zen Cart Modifications
    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.

  5. #5
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,475
    Plugin Contributions
    88

    Default Re: Digital download setup - error after checkout

    Quote Originally Posted by swguy View Post
    There appears to be an issue in 1.5.6 where for downloadable products which don't require a shipping address, this can happen.
    The solution should be to change includes/classes/order.php line 667 from

    'delivery_address_format_id' => $this->delivery['format_id'],

    to

    'delivery_address_format_id' => (int)$this->delivery['format_id'],
    Perhaps the delivery array should be initialized, since virtual products don't require/gather a shipping address. Changing lines 433-446 of the zc156c version of the order.php class:
    Code:
        if ($shipping_address->RecordCount() > 0) {
          $this->delivery = array('firstname' => $shipping_address->fields['entry_firstname'],
                                  'lastname' => $shipping_address->fields['entry_lastname'],
                                  'company' => $shipping_address->fields['entry_company'],
                                  'street_address' => $shipping_address->fields['entry_street_address'],
                                  'suburb' => $shipping_address->fields['entry_suburb'],
                                  'city' => $shipping_address->fields['entry_city'],
                                  'postcode' => $shipping_address->fields['entry_postcode'],
                                  'state' => ((zen_not_null($shipping_address->fields['entry_state'])) ? $shipping_address->fields['entry_state'] : $shipping_address->fields['zone_name']),
                                  'zone_id' => $shipping_address->fields['entry_zone_id'],
                                  'country' => array('id' => $shipping_address->fields['countries_id'], 'title' => $shipping_address->fields['countries_name'], 'iso_code_2' => $shipping_address->fields['countries_iso_code_2'], 'iso_code_3' => $shipping_address->fields['countries_iso_code_3']),
                                  'country_id' => $shipping_address->fields['entry_country_id'],
                                  'format_id' => (int)$shipping_address->fields['address_format_id']);
        }
    to pre-initialize that array, just in case:
    Code:
          $this->delivery = array(
            'firstname' => '',
            'lastname' => '',
            'company' => '',
            'street_address' => '',
            'suburb' => '',
            'city' => '',
            'postcode' => '',
            'state' => '',
            'zone_id' => 0,
            'country' => array(
                'id' => 0, 
                'title' => '', 
                'iso_code_2' => '', 
                'iso_code_3' => ''
            ),
            'country_id' => 0,
            'format_id' => 0
          );
        if ($shipping_address->RecordCount() > 0) {
          $this->delivery = array('firstname' => $shipping_address->fields['entry_firstname'],
                                  'lastname' => $shipping_address->fields['entry_lastname'],
                                  'company' => $shipping_address->fields['entry_company'],
                                  'street_address' => $shipping_address->fields['entry_street_address'],
                                  'suburb' => $shipping_address->fields['entry_suburb'],
                                  'city' => $shipping_address->fields['entry_city'],
                                  'postcode' => $shipping_address->fields['entry_postcode'],
                                  'state' => ((zen_not_null($shipping_address->fields['entry_state'])) ? $shipping_address->fields['entry_state'] : $shipping_address->fields['zone_name']),
                                  'zone_id' => $shipping_address->fields['entry_zone_id'],
                                  'country' => array('id' => $shipping_address->fields['countries_id'], 'title' => $shipping_address->fields['countries_name'], 'iso_code_2' => $shipping_address->fields['countries_iso_code_2'], 'iso_code_3' => $shipping_address->fields['countries_iso_code_3']),
                                  'country_id' => $shipping_address->fields['entry_country_id'],
                                  'format_id' => (int)$shipping_address->fields['address_format_id']);
        }

 

 

Similar Threads

  1. Replies: 1
    Last Post: 28 Aug 2010, 10:42 AM
  2. Replies: 0
    Last Post: 2 Jun 2010, 06:14 PM
  3. Can I use Zen-Cart for a digital download site w/google checkout?
    By Mr_bill in forum Addon Payment Modules
    Replies: 2
    Last Post: 2 May 2010, 12:59 PM
  4. Email password to customer after digital download
    By ballyc27 in forum Managing Customers and Orders
    Replies: 1
    Last Post: 28 Feb 2009, 11:38 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR