Results 1 to 9 of 9
  1. #1
    Join Date
    Jul 2008
    Location
    Rochester, NY
    Posts
    8
    Plugin Contributions
    0

    Default Stock by Attribute for ZC 1.3.9c/d changes to core files

    Thanks for reading this. I'm sorry if the answer is posted someplace else, but if it was I was not able to find it.

    I have ZC 1.3.9c, upgraded from 1.3.8a via script on a hosted site. Like many others, it is highly customized with changes to many PHP files to allow for add-ons not included in ZC. Not only that, I have made numerous of my own changes to add notations to templates and and messages throughout the ZC code... Needless to say it is a Frankenstein creation at this point.

    ...but, having said that, please understand that I am not PHP savvy, but I AM technology savvy, so although I was able to make very many changes they are not my own PHP code and my understanding of the PHP structure of the site is very limited.

    Stock by Attribute is something I recently released I need to implement more-or-less immediately. The latest release states it works with 1.3.9/1.3.9d, but the included core files would overwrite the files I have made my own changes too... this wouldn't be such a huge deal if the changes I made were only text, but some of the modifications were additional modules (such as one to create orders manually) that required me to make special changes outside of the instructions of the installs so that it worked ... I didn't document everything I did

    Replacing the files outright will simply break the rest of the store. I wanted to do a comparison and make the manual edits, but to me it appears that the core files included are from much older versions of ZC... based on my novice experience and knowledge of PHP code it appears that these files could be missing major changes in my version of ZC... Instead of the core files being from 1.3.9 which would only include the changes to allow the module to work, it is from the original version of the module and has been migrated through the ZC versions...

    So it seems that Not only would I have to compare MY changes, but the Changes to 1.3.9 AND the Module and derive the correct lines to remove, add, and leave alone... a daunting task that makes my little head spin.

    Has anyone determined what the actual lines of code that need to be added or changed in the Core files in order to made this mod work?

    Thanks!

  2. #2
    Join Date
    Sep 2008
    Location
    North Highlands, California 95660
    Posts
    286
    Plugin Contributions
    1

    Default Re: Stock by Attribute for ZC 1.3.9c/d changes to core files

    did you look up my stock by attribute, I updated it using 1.3.9D You'll have to use winmerge to adjust changes.

    http://www.gotleather.com/Stock_by_A...files_V4.8.zip

  3. #3
    Join Date
    Jul 2008
    Location
    Rochester, NY
    Posts
    8
    Plugin Contributions
    0

    Default Re: Stock by Attribute for ZC 1.3.9c/d changes to core files

    Thanks! I'll look at it now.

  4. #4
    Join Date
    Jul 2008
    Location
    Rochester, NY
    Posts
    8
    Plugin Contributions
    0

    Default Re: Stock by Attribute for ZC 1.3.9c/d changes to core files

    It looks like this was the major edit in the Orders.PHP (which was my major concern)

    // kuroi: SbA
    $option_name_array = explode(":", $order->products[$i]['attributes'][$j]['option']);
    $option_Name = $option_name_array[0];
    // end: sbA
    echo '<br /><nobr><small>&nbsp;<i> - ' . $option_Name . ': ' . nl2br($order->products[$i]['attributes'][$j]['value']);


    Thank you so much. This version of the Stock-by-attribute is much cleaner and easier for me sift through. I'm going to bet that the rest of the files will also be so I will say thanks now. If I have any other questions I'll come back. Thanks again!

  5. #5
    Join Date
    Jul 2008
    Location
    Rochester, NY
    Posts
    8
    Plugin Contributions
    0

    Default Re: Stock by Attribute for ZC 1.3.9c/d changes to core files

    OK, All worked as expected except...

    I have configured products with a two-option selection. When a customer adds a product they must select

    -flavor option (1 - 4)
    -strength option (a - d)

    The problem lies where production option combination for, say, 3b does not exist or has 0 stock. The customer is allowed to select it anyway... which is confusing because the message will appear stating that there is not enough qty on hand... Now I could change the message but that still leaves the customer guessing as to what is in stock... or I could display my stock, but my stock is very low and I would prefer not to advertise this.

    I would rather not display a combination of options that have 0 stock or do not exist so the customer cannot select it in the first place. Is this possible to do?

  6. #6
    Join Date
    Sep 2008
    Location
    North Highlands, California 95660
    Posts
    286
    Plugin Contributions
    1

    Default Re: Stock by Attribute for ZC 1.3.9c/d changes to core files

    See if this helps you out:

    open /includes/modules/attributes.php and replace this:

    PHP Code:
    $sql "select    pov.products_options_values_id,
                            pov.products_options_values_name,
                            pa.*
                  from      " 
    TABLE_PRODUCTS_ATTRIBUTES " pa, " TABLE_PRODUCTS_OPTIONS_VALUES " pov
                  where     pa.products_id = '" 
    . (int)$_GET['products_id'] . "'
                  and       pa.options_id = '" 
    . (int)$products_options_names->fields['products_options_id'] . "'
                  and       pa.options_values_id = pov.products_options_values_id
                  and       pov.language_id = '" 
    . (int)$_SESSION['languages_id'] . "' " .
                    
    $order_by
    with this:

    PHP Code:
    $sql=    "SELECT  pov.products_options_values_id,
                                pov.products_options_values_name,
                                pa.*,
                                pwas.*
                    FROM   " 
    TABLE_PRODUCTS_OPTIONS_VALUES " pov, " TABLE_PRODUCTS_ATTRIBUTES " pa LEFT JOIN " TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK " pwas ON pwas.stock_attributes = pa.products_attributes_id
                    WHERE   pa.products_id = '" 
    . (int)$_GET['products_id'] . "'
                       and    pa.options_id = '" 
    . (int)$products_options_names->fields['products_options_id'] . "'
                    and    (pwas.quantity > 0 or pwas.quantity IS NULL)
                      and    pa.options_values_id = pov.products_options_values_id
                     and       pov.language_id = '" 
    . (int)$_SESSION['languages_id'] . "' " .
                    
    $order_by

  7. #7
    Join Date
    Sep 2008
    Location
    North Highlands, California 95660
    Posts
    286
    Plugin Contributions
    1

    Default Re: Stock by Attribute for ZC 1.3.9c/d changes to core files

    Or you may want to install the Dynamic Drop Downs for SBA mod, it has an option in it to: Prevent Adding Out of Stock to Cart

  8. #8
    Join Date
    Jul 2008
    Location
    Rochester, NY
    Posts
    8
    Plugin Contributions
    0

    Default Re: Stock by Attribute for ZC 1.3.9c/d changes to core files

    creinold,

    Thank you. I will try it out and let you know. My novice understanding of PHP and SQL tell me that this looks like it if I run out of stock on an attribute item it will not include it in the selectable items. I don't think I'll be able to put this mod tonight, but I will let you know.

    Thanks again!

  9. #9
    Join Date
    Jul 2008
    Location
    Rochester, NY
    Posts
    8
    Plugin Contributions
    0

    Default Re: Stock by Attribute for ZC 1.3.9c/d changes to core files

    Has it been this long since I last posted? I'm so sorry. As I expected, your code worked perfectly. Thank you so much!

 

 

Similar Threads

  1. Need to change core files for this?
    By sunrise11 in forum Templates, Stylesheets, Page Layout
    Replies: 20
    Last Post: 9 May 2011, 04:33 AM
  2. So I Edited The Core Files
    By Battlefront Games in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 25 Aug 2010, 04:37 PM

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