Page 1 of 2 12 LastLast
Results 1 to 10 of 1916

Hybrid View

  1. #1
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Edit Orders v4.0 Support Thread

    ZenCart V1.5.1
    Edit Orders 4.1.2
    Super Orders 4.0.7
    Stock by Attribute 1.5.1.2

    Problem.
    When editing an order the attributes setting is getting reset to a default value.

    Is this a known problem? Is a fix available?

    Cheers
    Rod

  2. #2
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: Edit Orders v4.0 Support Thread

    Quote Originally Posted by RodG View Post
    ZenCart V1.5.1
    Edit Orders 4.1.2
    Super Orders 4.0.7
    Stock by Attribute 1.5.1.2

    Problem.
    When editing an order the attributes setting is getting reset to a default value.

    Is this a known problem? Is a fix available?
    Not a known issue (except for file uploads, which are not currently supported)...

    I do not currently use any of the "stock by attribute" modules... Does this module make any changes to the handling of attributes on the catalog side? Does it add additional option types (which may not be understood by the stock ZC code)? If either is true... One may need to replicate those changes in the eo_* functions (or edit_orders.php when attributes are displayed)...
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

  3. #3
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Edit Orders v4.0 Support Thread

    Quote Originally Posted by lhungil View Post
    Not a known issue (except for file uploads, which are not currently supported)...

    I do not currently use any of the "stock by attribute" modules... Does this module make any changes to the handling of attributes on the catalog side? Does it add additional option types (which may not be understood by the stock ZC code)? .
    I don't know. I figured it would be worth asking here first before diving into how it all worked.

    Quote Originally Posted by lhungil View Post
    If either is true... One may need to replicate those changes in the eo_* functions (or edit_orders.php when attributes are displayed)...
    Yeah, that's pretty much what I thought.

    It looks like I'm going to have to dive into the code anyway, because the client also has the " Your Store Gift Cards (plastic, etc)" module installed (http://www.zen-cart.com/downloads.php?do=file&id=718), and although this does show up in the edit dropdown menu along with the Discount Voucher and Gift certificates as being editable items, the amounts entered with this are not being acted upon for the order totals.

    Oh, while I'm on the topic, it took me a bit of head scratching to get the Discount Vouchers to work within the editor. It kept giving "Warning: The coupon code was not found in the title. The title / text of a coupon must be formated like "Discount Coupon : coupon_code :".
    Sure enough, when I entered the data exactly like the warning suggests it worked as expected. I would have thought the 'Discount Coupon:" would be automatically derived and inserted via the dropdown selector (which I assume is happening for the Gift Certificates).
    I'm not sure if this is a bug or not. I thought it worth mentioning though.

    Cheers
    Rod

  4. #4
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,021
    Plugin Contributions
    32

    Default Re: Edit Orders v4.0 Support Thread

    Quote Originally Posted by RodG View Post
    Oh, while I'm on the topic, it took me a bit of head scratching to get the Discount Vouchers to work within the editor. It kept giving "Warning: The coupon code was not found in the title. The title / text of a coupon must be formated like "Discount Coupon : coupon_code :".
    Sure enough, when I entered the data exactly like the warning suggests it worked as expected. I would have thought the 'Discount Coupon:" would be automatically derived and inserted via the dropdown selector (which I assume is happening for the Gift Certificates).
    I'm not sure if this is a bug or not. I thought it worth mentioning though.
    Not a bug.. this is how it works, and I believe the readme covers this..
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  5. #5
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: Edit Orders v4.0 Support Thread

    Quote Originally Posted by RodG View Post
    ...
    Oh, while I'm on the topic, it took me a bit of head scratching to get the Discount Vouchers to work within the editor. It kept giving "Warning: The coupon code was not found in the title. The title / text of a coupon must be formated like "Discount Coupon : coupon_code :".
    Sure enough, when I entered the data exactly like the warning suggests it worked as expected. ...
    Quote Originally Posted by DivaVocals View Post
    Not a bug.. this is how it works, and I believe the readme covers this..
    Yup this is how it works (and why we added a message to tell people). Why? Because ot_coupon stores the coupon name and code as the "title" for the order total. So basically the title needs to be formatted to match what ot_coupon expects ;)
    Last edited by lhungil; 1 Dec 2013 at 11:07 PM.
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

  6. #6
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Edit Orders v4.0 Support Thread

    Quote Originally Posted by lhungil View Post
    Not a known issue (except for file uploads, which are not currently supported)...
    It's a bug.

    edit_orders.php , Line#894 , reads:

    switch($optionInfo['type']) {

    The problem is $optionInfo['type'] doesn't appear to be getting set anywhere, therefore none of the CASE's will ever match.

    I've not had a chance to look into *why* this array variable isn't being set, but I've proved the point, by changing the line to read
    switch("TEST") ;

    then adding a case "TEST" just below the "case PRODUCTS_OPTIONS_TYPE_RADIO" and "case PRODUCTS_OPTIONS_TYPE_SELECT" lines.

    Not really a viable solution, but as I said, it proves a point. The RADIO and SELECT type attributes then work flawlessly.

    Cheers
    Rod

  7. #7
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Edit Orders v4.0 Support Thread

    Quote Originally Posted by RodG View Post
    It's a bug.
    But NOT in the edit orders code.

    I've traced this back to the source and the bug is in the stock by attributes code.

    I'll follow this up with the details in the appropriate forum tomorrow.

    Must get sleep.... its been a loooong day.

    Cheers
    Rod

  8. #8
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,021
    Plugin Contributions
    32

    Default Re: Edit Orders v4.0 Support Thread

    Quote Originally Posted by RodG View Post
    But NOT in the edit orders code.

    I've traced this back to the source and the bug is in the stock by attributes code.

    I'll follow this up with the details in the appropriate forum tomorrow.

    Must get sleep.... its been a loooong day.

    Cheers
    Rod
    If the issue is in SBA (and you are going to address this on the SBA support thread), but will affect Edit Orders, could you share your findings here as well..
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  9. #9
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Edit Orders v4.0 Support Thread

    Quote Originally Posted by DivaVocals View Post
    If the issue is in SBA (and you are going to address this on the SBA support thread), but will affect Edit Orders, could you share your findings here as well..
    I'm still chasing this rabbit down the hole. .. and after following many threads it once again appears to be an Edit Orders issue and not directly related to the SBA mod.

    Here's where I'm currently at:

    ile: /admin/edit_orders.php


    ------------------ Updated to avoid the need for the strange syntax current required (my clients have a bit of a problem following the instructions, and would prefer to just enter the coupon code_


    ----------------- Original code ----------------------------------------
    case 'ot_coupon':
    preg_match('/([^:]+)[^:]+):/', $order_total['title'], $matches);
    //DEBUG echo '<div>Coupon Matches</div><pre>'; var_dump($matches); echo '</pre>';
    if(count($matches) > 2) {
    $order_total['title'] = trim($matches[1]);
    $cc_id = $db->Execute(
    'SELECT coupon_id FROM `' . TABLE_COUPONS . '` ' .
    'WHERE coupon_code=\'' . trim($matches[2]) . '\''
    );
    if(!$cc_id->EOF) $_SESSION['cc_id'] = $cc_id->fields['coupon_id'];
    else {
    $messageStack->add_session(WARNING_ORDER_COUPON_BAD, 'warning');
    $order_total['title'] = '';
    $order_total['value'] = 0;
    }
    }
    else {
    $messageStack->add_session(WARNING_ORDER_COUPON_BAD_FORMAT, 'warning');
    $order_total['title'] = '';
    $order_total['value'] = 0;
    }


    break;


    ------------ Replacement code ----------------------------------------------
    case 'ot_coupon':
    $order_total['title'] = "Discount Coupon:" . $order_total['title'] .":" ;

    preg_match('/([^:]+)[^:]+):/', $order_total['title'], $matches);
    //DEBUG echo '<div>Coupon Matches</div><pre>'; var_dump($matches); echo '</pre>'; die ;
    $order_total['title'] = trim($matches[1]);
    $cc_id = $db->Execute(
    'SELECT coupon_id FROM `' . TABLE_COUPONS . '` ' .
    'WHERE coupon_code=\'' . trim($matches[2]) . '\''
    );


    if(!$cc_id->EOF) $_SESSION['cc_id'] = $cc_id->fields['coupon_id'];
    else {
    $messageStack->add_session(WARNING_ORDER_COUPON_BAD, 'warning');
    $order_total['title'] = '';
    $order_total['value'] = 0;
    }
    break;
    -------------------------------------------------------------------------------------


    This same file /admin/edit_orders.php has a
    switch($optionInfo['type']) block, with case references to:


    PRODUCTS_OPTIONS_TYPE_RADIO
    PRODUCTS_OPTIONS_TYPE_SELECT
    PRODUCTS_OPTIONS_TYPE_TEXT
    PRODUCTS_OPTIONS_TYPE_FILE
    PRODUCTS_OPTIONS_TYPE_READONLY
    PRODUCTS_OPTIONS_TYPE_CHECKBOX


    These don't appear to be defined anywhere, so nothing matches. (bug?)


    I've 'fixed' this problem by making the following edits to
    /admin/includes/classes/attributes.php
    (I thought this was from the SBA mod, but I've since found it to be from the Edit orders mod)


    Added these defines at the beginning of the file
    ------------------------------------------------------------
    define('PRODUCTS_OPTIONS_TYPE_RADIO', 'Radio') ;
    define('PRODUCTS_OPTIONS_TYPE_SELECT', 'Dropdown');
    define('PRODUCTS_OPTIONS_TYPE_TEXT', 'Text') ;
    define('PRODUCTS_OPTIONS_TYPE_FILE', 'File') ;
    define('PRODUCTS_OPTIONS_TYPE_READONLY', 'Read Only') ;
    define('PRODUCTS_OPTIONS_TYPE_CHECKBOX', 'Checkbox') ; // is this a valid option? It doesn't appear in the database as such?
    -------------------------------------------------------------


    These are probably best suited in another datafile, or at the very least, add a check to ensure they don't try to get redefined.


    ---- replaced the get_attributes_options with this ---------------


    function get_attributes_options($zf_product_id, $readonly = false) {
    global $db;


    $query = 'SELECT attr.products_attributes_id, attr.products_id, attr.options_id, opt.products_options_name,
    type.products_options_types_name, type.products_options_types_id,
    val.products_options_values_name, opt.products_options_type,
    products_options_size, opt.products_options_rows ' .
    'FROM ' . TABLE_PRODUCTS_ATTRIBUTES . ' AS attr ' .
    'LEFT JOIN ' . TABLE_PRODUCTS_OPTIONS .
    ' AS opt ON attr.options_id = opt.products_options_id ' .
    'LEFT JOIN ' . TABLE_PRODUCTS_OPTIONS_VALUES .
    ' AS val ON attr.options_values_id = val.products_options_values_id ' .
    'LEFT JOIN ' . TABLE_PRODUCTS_OPTIONS_TYPES .
    ' AS type ON type.products_options_types_id = opt.products_options_type ' .
    'WHERE attr.products_id = \'' . (int)$zf_product_id . '\' ' .
    'AND val.language_id = \'' . (int)$_SESSION['languages_id'] . '\' ' .
    'AND val.language_id = opt.language_id ';


    // Don't include READONLY attributes if product can be added to cart without them
    if(PRODUCTS_OPTIONS_TYPE_READONLY_IGNORED == '1' && $readonly === false) {
    $query .= 'AND opt.products_options_type != \'' . PRODUCTS_OPTIONS_TYPE_READONLY . '\' ';
    }


    $query .= 'ORDER BY `opt`.`products_options_sort_order`, `attr`.`options_id`';


    if($this->cache_time == 0) $queryResult = $db->Execute($query);
    else $queryResult = $db->Execute($query, false, true, $this->cache_time);


    $retval = array();
    while (!$queryResult->EOF) {

    $retval[$queryResult->fields['products_attributes_id']] = array(
    'id' => $queryResult->fields['options_id'],
    'name' => $queryResult->fields['products_options_name'],
    'value' => $queryResult->fields['products_options_values_name'],
    // 'type' => $queryResult->fields['products_options_type'],
    'type' => $queryResult->fields['products_options_types_name'],


    'length' => $queryResult->fields['products_options_length'],
    'size' => $queryResult->fields['products_options_size'],
    'rows' => $queryResult->fields['products_options_rows']
    );
    $queryResult->MoveNext();
    }

    return $retval;
    }


    ---------------------------------------------------------------------------------------------------------


    These changes seems to cure most of the problems I was having with the site I'm working on.

    Cheers
    Rod

  10. #10
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,942
    Plugin Contributions
    96

    Default Re: Edit Orders v4.0 Support Thread

    Quote Originally Posted by RodG View Post
    This same file /admin/edit_orders.php has a
    switch($optionInfo['type']) block, with case references to:


    PRODUCTS_OPTIONS_TYPE_RADIO
    PRODUCTS_OPTIONS_TYPE_SELECT
    PRODUCTS_OPTIONS_TYPE_TEXT
    PRODUCTS_OPTIONS_TYPE_FILE
    PRODUCTS_OPTIONS_TYPE_READONLY
    PRODUCTS_OPTIONS_TYPE_CHECKBOX


    These don't appear to be defined anywhere, so nothing matches. (bug?)


    I've 'fixed' this problem by making the following edits to
    /admin/includes/classes/attributes.php
    (I thought this was from the SBA mod, but I've since found it to be from the Edit orders mod)


    Added these defines at the beginning of the file
    ------------------------------------------------------------
    define('PRODUCTS_OPTIONS_TYPE_RADIO', 'Radio') ;
    define('PRODUCTS_OPTIONS_TYPE_SELECT', 'Dropdown');
    define('PRODUCTS_OPTIONS_TYPE_TEXT', 'Text') ;
    define('PRODUCTS_OPTIONS_TYPE_FILE', 'File') ;
    define('PRODUCTS_OPTIONS_TYPE_READONLY', 'Read Only') ;
    define('PRODUCTS_OPTIONS_TYPE_CHECKBOX', 'Checkbox') ; // is this a valid option? It doesn't appear in the database as such?
    -------------------------------------------------------------
    Oh no! Don't do that! Those constants are defined in the database and provide a mapping to the products_options_types table row associated with that option name.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v150 Super Orders v4.0 Support Thread for ZC v1.5.x
    By DivaVocals in forum Addon Admin Tools
    Replies: 817
    Last Post: 29 Apr 2026, 07:53 PM
  2. v150 Orders Status History -- Updated By [Support Thread]
    By lat9 in forum Addon Admin Tools
    Replies: 34
    Last Post: 29 Jul 2019, 07:05 PM
  3. Edit Orders v3.0 for ZC 1.3.9 [Support Thread]
    By DivaVocals in forum All Other Contributions/Addons
    Replies: 656
    Last Post: 18 Apr 2016, 06:28 PM
  4. v139h Super Orders v3.0 Support Thread (for ZC v1.3.9)
    By DivaVocals in forum All Other Contributions/Addons
    Replies: 1018
    Last Post: 28 Apr 2014, 11:38 PM
  5. RE: Super Orders v3.0 Support Thread
    By Johnnyd in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 22 Jun 2011, 09:28 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