Page 158 of 357 FirstFirst ... 58108148156157158159160168208258 ... LastLast
Results 1,571 to 1,580 of 3566
  1. #1571
    Join Date
    Jul 2012
    Posts
    1
    Plugin Contributions
    0

    Default Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

    I did all the changes, but then I just get a white store. The admin-area works fine, the Stock by Attributes is there in my 1.5, but my store is just plain white.
    Anyone knows why that is?

  2. #1572
    Join Date
    Jun 2012
    Posts
    57
    Plugin Contributions
    2

    Default Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

    Did you merge the code or copy it? In order for this to work, you must merge the code and merge only those sections labeled for stock by attributes. The problem here is that the code sections were not labeled in some of the files, and it gets a little tricky - but still doable.

  3. #1573

    Default Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

    Toneklone,

    Did you resolve this issue? If so how? I am having the same problem and I did merge the files. I'm pretty sure the issue is with the file: admin/includes/functions/general.php

    But you have to restore all the original ZC files that were modified or overwritten before the white screen returns to normal. I checked my site each time I uploaded a merged file and the one stated above was what sent my site to a white screen. Just restoring that file didn't fix it though.

    If anyone else could help it would be much appreciated. Thank you.

  4. #1574
    Join Date
    Jan 2011
    Posts
    65
    Plugin Contributions
    0

    Default Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

    ATTENTION: Restock Feature has been FIXED!!!!

    Sorry for the caps, but I am just too excited

    I really had to get the functionality of this feature to start working, well because, a typical order for my store might contain numerous products, and having to manually edit the stock for each product when I deleted a large order was not practical.

    So without further Adieu! -

    In \admin\includes\functions\general.php look for the following code:

    Code:
    function zen_remove_order($order_id, $restock = false) {
        global $db, $order;
        if ($restock == 'on') {
          $order = $db->Execute("select products_id, products_quantity
                                 from " . TABLE_ORDERS_PRODUCTS . "
                                 where orders_id = '" . (int)$order_id . "'");
    
          while (!$order->EOF) {
            //restored db
            $restored_attributes = $db->Execute("select pa.products_attributes_id    
                                                  from ".TABLE_ORDERS_PRODUCTS_ATTRIBUTES." opa, ".TABLE_PRODUCTS_ATTRIBUTES." pa
                                                  where opa.orders_id='".(int)$order_id."'
                                                  and opa.products_options_id = pa.options_id
                                                  and pa.options_values_id = opa.products_options_values_id
                                                  and pa.products_id='".(int)$order->fields['products_id']."'
                                                  ORDER BY pa.products_attributes_id ASC
                                                ");
            while(!$restored_attributes->EOF) {
              $attr_array[] = $restored_attributes->fields['products_attributes_id'];
              $restored_attributes->MoveNext();
            }
            //echo implode(',', $attr_array);die;
            $db->Execute("update ".TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK." 
                            set quantity = quantity + " . $order->fields['products_quantity'] . " 
                            where products_id = '" . (int)$order->fields['products_id'] . "'
                            and stock_attributes = '".implode(',', $attr_array)."'
                          ");
            $db->Execute("update " . TABLE_PRODUCTS . "
                          set products_quantity = products_quantity + " . $order->fields['products_quantity'] . ", products_ordered = products_ordered - " . $order->fields['products_quantity'] . " where products_id = '" . (int)$order->fields['products_id'] . "'");
            $order->MoveNext();
          }
        }
    And replace with...

    Code:
    function zen_remove_order($order_id, $restock = false) {
        global $db, $order;
        if ($restock == 'on') {
          $order = $db->Execute("select orders_products_id, products_id, products_quantity
                                 from " . TABLE_ORDERS_PRODUCTS . "
                                 where orders_id = '" . (int)$order_id . "'");
    
          while (!$order->EOF) {
            //restored db
            $restored_attributes = $db->Execute("select pa.products_attributes_id    
                                                  from ".TABLE_ORDERS_PRODUCTS_ATTRIBUTES." opa, ".TABLE_PRODUCTS_ATTRIBUTES." pa
                                                  where opa.orders_id='".(int)$order_id."'
                                                  and opa.products_options_id = pa.options_id
                                                  and opa.products_options_values_id = pa.options_values_id
    					      and opa.orders_products_id='".(int)$order->fields['orders_products_id']."'
                                                  and pa.products_id='".(int)$order->fields['products_id']."'
                                                  ORDER BY pa.products_attributes_id ASC
                                                ");
            while(!$restored_attributes->EOF) {
              $attr_array[] = $restored_attributes->fields['products_attributes_id'];
              $restored_attributes->MoveNext();
            }
            $db->Execute("update ".TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK." 
                            set quantity = quantity + " . $order->fields['products_quantity'] . " 
                            where products_id = '" . (int)$order->fields['products_id'] . "'
                            and stock_attributes = '".implode(',', $attr_array)."'
                          ");
            $db->Execute("update " . TABLE_PRODUCTS . "
                          set products_quantity = products_quantity + " . $order->fields['products_quantity'] . ", products_ordered = products_ordered - " . $order->fields['products_quantity'] . " where products_id = '" . (int)$order->fields['products_id'] . "'");
            unset($attr_array);
    	$order->MoveNext();
          }
        }
    But just a little background and forewarning, I am by no means a programmer, just a noobie, but proficient computer nerd who has had a little background in programming back in college. I sat down for the past 12 hours trying to dissect the logic of tying the line items of the ORDERS_PRODUCTS table (which records each of your unique products sold and in what quantities) to the PRODUCTS_WITH_ATTRIBUTES_STOCK table (which contains your master list of stock for each unique attribute of your product inventory) in the zen-cart database, and realized that the arguments utilized were not specific enough to appropriately identify tie the two tables together accurately.

    Furthermore, $attr_array needs to be unset after each iteration, or else data just gets appended to the end of it, causing the whole function to simply not work.

    PLEASE NOTE:

    This needs more testing and input from the rest of you guys who use this module, because my store's attributes are set up where the only unique attribute I use is color.

    So if your store's products are similar to mine, I'm sure that the fix above will work, but if you have multiple attribute combinations (such as size and color), then please test cautiously, and provide your feedback. From looking at the code, I believe it should work in all scenarios...but I can't be for certain.

    Also, PLEASE test with caution!!! I would suggest creating a few dummy orders and taking note of your quantities before and after placing your dummy order then monitoring the stock levels after you delete the dummy order and choose to restock the items! It should go without saying, but...obviously don't test this on real live orders :)

    Hopefully this helps out a lot of you out there, and this code (or at least the logic to make the restock feature work) make it to the 1.5 version of SBA!
    Last edited by RoboPhung; 1 Sep 2012 at 10:44 PM.

  5. #1575
    Join Date
    Jan 2011
    Posts
    65
    Plugin Contributions
    0

    Default Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

    Sorry, also important to note for my above solution, this is for ZC 1.3.9h only! I don't have any experience with 1.5 and don't know if the code has changed much, if any, in 1.5...so I can only guarantee this to be working with the latest verion of SBA for ZC 1.3.9h.

  6. #1576
    Join Date
    Feb 2004
    Posts
    1,278
    Plugin Contributions
    0

    Default Re: Stock by Attribute v4.0 for Zen Cart 1.3.5

    My site is getting this error

    1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND pa2.products_attributes_id IN (19821) ' at line 3
    in:
    [SELECT count(DISTINCT pa1.options_id) AS matches FROM products_attributes pa1, products_attributes pa2 WHERE pa1.products_attributes_id IN () AND pa2.products_attributes_id IN (19821) AND pa1.options_id = pa2.options_id]
    http://www.nothingbutcostumes.com/bi...me-p-9007.html

    Any suggestion on how I can fix this???

    Thanks in advance

  7. #1577
    Join Date
    Feb 2004
    Posts
    1,278
    Plugin Contributions
    0

    Default Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

    I searched my store for pa1 and narrowed the problem. Is there something I can comment out to remove this problem??



    /home/nothingb/public_html/includes/functions/functions_lookups.php
    Line #272 : SELECT pov1.products_options_id FROM (products_attributes pa1

    Line #274 : ON pa1.options_values_id = pov1.products_options_values_id)

    Line #278 : WHERE pa1.products_attributes_id IN ( $atr ) AND pa2.products_attributes_id IN ( $atr2 )

    Line #288 : $res2 = $db->Execute("SELECT count(DISTINCT pa1.options_id) AS matches

    Line #289 : FROM products_attributes pa1, products_attributes pa2

    Line #290 : WHERE pa1.products_attributes_id IN ($atr)

    Line #292 : AND pa1.options_id = pa2.options_id");

    Line #321 : $res2 = $db->Execute("SELECT DISTINCT pa1.products_attributes_id AS needed

    Line #322 : FROM products_attributes pa1, products_attributes pa2

    Line #323 : WHERE pa1.products_attributes_id IN ($atr)

    Line #325 : AND pa1.options_id = pa2.options_id

    Line #326 : ORDER BY pa1.products_attributes_id");

    /home/nothingb/public_html/snickers/includes/functions/extra_functions/functions_qty_attribute.php
    Line #34 : (products_attributes pa1 INNER JOIN products_options_values_to_products_options pov1

    Line #35 : ON pa1.options_values_id = pov1.products_options_values_id)

    Line #42 : WHERE pa1.products_attributes_id IN ( $atr )

    Line #53 : $res2 = $db->Execute("SELECT count(DISTINCT pa1.options_id) AS matches

    Line #54 : FROM products_attributes pa1, products_attributes pa2

    Line #55 : WHERE pa1.products_attributes_id IN ($atr)

    Line #57 : AND pa1.options_id = pa2.options_id;");

  8. #1578
    Join Date
    Feb 2004
    Posts
    1,278
    Plugin Contributions
    0

    Default Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

    Dr Byte once said

    "WHERE pa1.products_attributes_id IN ()"
    You're telling it to lookup a products_attributes_id in the list of values specified inside the parentheses, but your list is empty, thus you're creating a MySQL syntax error. Hence the error message.
    So I see the 2 places... What can I do now?

    Code:
    WHERE pa1.products_attributes_id IN ($atr)
    Is the problem..

  9. #1579
    Join Date
    Jan 2004
    Posts
    66,380
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

    Quote Originally Posted by milobloom View Post
    So I see the 2 places... What can I do now?

    Code:
    WHERE pa1.products_attributes_id IN ($atr)
    Simple: fix the code that creates the contents of $atr
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  10. #1580
    Join Date
    Feb 2004
    Posts
    1,278
    Plugin Contributions
    0

    Default Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

    $atr = implode(',',$attributes);
    in

    /home/nothingb/public_html/includes/functions/functions_lookups.php

    Can I change this to something?

 

 

Similar Threads

  1. Problems with addon: Dynamic Drop Downs for Stock By Attribute
    By Dunk in forum All Other Contributions/Addons
    Replies: 56
    Last Post: 30 Apr 2014, 07:55 PM
  2. MySQL Problem with Product with Attribute Stock addon
    By rtwingfield in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 20 Sep 2011, 03:35 PM
  3. Hide Zero Quantity Attributes with attribute-stock addon
    By leevil123 in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 11 Feb 2010, 05:06 PM
  4. Replies: 4
    Last Post: 22 Jan 2010, 10:43 PM
  5. Price Products in the grid by 'Stock by Attribute' addon?
    By Salixia in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 27 Oct 2009, 06:03 PM

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