Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 49
  1. #21
    Join Date
    Oct 2005
    Location
    Finland
    Posts
    186
    Plugin Contributions
    1

    Default Re: Unique SKU for each attribute?

    Update!

    I have got most of it working now, I guess it's only those two files mention who's making trouble for me now.

    In admin it brakes the site, it's only showing parts of the new feature. But if I manually add ID's to the database I get those skus, options and values showing. But I'm not able to add anything from the site.

    In the shop I don't get the sku into shopping cart, but the sku field is showing - I guess it's most likely because of wrong placement of code in includes/classes/order.php

    I'm still digging into it, but I would really appreciate if anyone could give more specific location for those new inserts (code above and/or below). ;)

  2. #22
    Join Date
    Oct 2005
    Location
    Finland
    Posts
    186
    Plugin Contributions
    1

    Idea or Suggestion Re: Unique SKU for each attribute?

    New update, and this time with some files to play with. :)

    Seems like I have sorted out most of it, and I have also rewritten it to be multilingual (English and Norwegian included) - and to allow use of prefix on the database tables.

    Everything works fine, and the attributes sku is added and shown in shopping cart - and on orders, invoices and packingslips.

    For some reason the sku is not showing on the checkout confirmation, so if someone could figure out that it would be great. Maybe something should be added to '../includes/modules/pages/checkout_confirmation/header_php' ??

    Also in admin/attributes_controller.php the layout could need some fixing, not even sure the placement is the best (or right) - but its working for now. :)

    NOTE! As always, use at your own risk - no guaranty given on anything. ;)
    Attached Files Attached Files

  3. #23
    Join Date
    Oct 2007
    Posts
    11
    Plugin Contributions
    0

    Idea or Suggestion Re: Unique SKU for each attribute?

    I'm working on a similar mod, but instead of it using an arbitrary "sku" it's going off the product_model, in addition I've made a "hidden" category to put the "child items" in, so you choose an option from the Parent item it will put the "child item id" in the basket based on the option, that way stock is still being kept track of and can be easily modified.

    The users never see the child item product info page, just the parent page.

    Make sense? I'll post it as soon as I'm done thoroughly testing.
    -Aaron

  4. #24

    Default Re: Unique SKU for each attribute?

    Glad you are getting there. For the checkout confirmation page, this is what I did.

    I changed includes/templates/default/templates/tpl_checkout_confirmation_default.php

    I modified the table around line 55 to this:

    PHP Code:
    <table id="cartContentsDisplay">
        <tr class="cartTableHeading">
            <th id="ccQuantityHeading"><?php echo TABLE_HEADING_QUANTITY?></th>
            <th id="ccProductsHeading"><?php echo TABLE_HEADING_PRODUCTS?></th>
            <th id="ccTotalHeading"><?php echo TABLE_HEADING_TOTAL?></th>
        </tr>
        <?php // now loop thru all products to display quantity and price 
        
    for ($i=0$n=sizeof($order->products); $i<$n$i++) { 
        
    ?>
        <tr class="<?php echo $order->products[$i]['rowClass']; ?>">
            <td class="cartQuantity"><?php echo $order->products[$i]['qty']; ?>&nbsp;x</td>
            <td class="cartProductDisplay"><?php echo $order->products[$i]['name']; ?>
                <?php // if there are attributes, loop thru them and display one per line
                
    if (isset($order->products[$i]['attributes']) && sizeof($order->products[$i]['attributes']) > ) {
                    echo 
    '<ul class="cartAttribsList">';
                    
    $pas = array();
                    
    $list '';
                    for (
    $j=0$n2=sizeof($order->products[$i]['attributes']); $j<$n2$j++) {
                        
    $list .= '<li>'.$order->products[$i]['attributes'][$j]['option'].': '.nl2br($order->products[$i]['attributes'][$j]['value']).'</li>';
                        
    $pas[] = $order->products[$i]['attributes'][$j]['products_attributes_id'];
                    }
                    
    sort($pas);
                    
    $products_attributes_ids '';
                    for (
    $x=0$x<count($pas); ++$x) {
                        
    $products_attributes_ids .= $pas[$x].'_';
                    }
                    
    $products_attributes_ids trim($products_attributes_ids"_");
                    
    $get_sku $db->Execute("select sku from products_attributes_skus where products_id = '".$order->products[$i]['id']."' and products_attributes_ids = '".$products_attributes_ids."'");
                    
    $list '<li>SKU: '.$get_sku->fields['sku'].'</li>'.$list;
                    echo 
    $list;
                    echo 
    '</ul>';
                } 
    // endif attribute-info
                
    ?>
            </td>
            <td class="cartTotalDisplay">
                <?php echo $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']);
                if (
    $order->products[$i]['onetime_charges'] != ) {
                    echo 
    '<br /> ' $currencies->display_price($order->products[$i]['onetime_charges'], $order->products[$i]['tax'], 1);
                }
                
    ?>
            </td>
        </tr>
        <?php  }  // end for loopthru all products ?>
    </table>
    Hope that helps

  5. #25
    Join Date
    Oct 2005
    Location
    Finland
    Posts
    186
    Plugin Contributions
    1

    Default Re: Unique SKU for each attribute?

    Yes, I have the exact same code inserted in tpl_checkout_confirmation_default.php and SKU: is showing up, but the number is missing - and I haven't figured out way yet.

  6. #26
    Join Date
    Oct 2005
    Location
    Finland
    Posts
    186
    Plugin Contributions
    1

    Default Re: Unique SKU for each attribute?

    Hi Ryan (or someone else) could you try to clarify this part a bit, especial the line:
    After the if statement closes that the for loop from above is in
    Seems like there's some trouble in this particular file, and I guess it's why the sku is missing on the checkout page.

    Quote Originally Posted by ryanf View Post
    Next I modified includes/classes/order.php

    I added the line:
    PHP Code:
    $pas = array(); 
    in the function create_add_products()
    and the line:
    PHP Code:
    // build products_attributes_id list to get sku number later
    $pas[] = $attributes_values->fields['products_attributes_id']; 
    At the end of the for loop in the same function that starts with:
    PHP Code:
    for ($j=0$n2=sizeof($this->products[$i]['attributes']); $j<$n2$j++) { 
    After the if statement closes that the for loop from above is in, I added:
    PHP Code:
    // add sku number to attributes
    sort($pas);
            
    $products_attributes_ids '';
    for (
    $x=0$x<count($pas); ++$x) {
        
    $products_attributes_ids .= $pas[$x].'_';
    }
    $products_attributes_ids trim($products_attributes_ids"_");
    $get_sku $db->Execute("select sku from products_attributes_skus where products_id = '".$this->products[$i]['id']."' and products_attributes_ids = '".$products_attributes_ids."'");
    $this->products_ordered_attributes "\n\tSKU: ".$get_sku->fields['sku']. $this->products_ordered_attributes
    This adds the sku information to the product information in the shopping cart and to be used in places such as invoices.

  7. #27
    Join Date
    Oct 2005
    Location
    Finland
    Posts
    186
    Plugin Contributions
    1

    Default Re: Unique SKU for each attribute?

    Hm.. please overlook that last post, maybe I'm in need of some sleep now ...

    If includes/classes/order.php wasn't correct, the sku would not have been showing up in the shopping cart either. So there has to be something else missing somewhere ...

  8. #28
    Join Date
    Jan 2008
    Posts
    11
    Plugin Contributions
    0

    Default Re: Unique SKU for each attribute?

    Using this mod, when I try to asign an SKU to an already given attribute it keeps saying:
    "Attribute Option and Option Value Do NOT Match - Attribute was not added - : TEXT"
    I guess I don`t need to mention that I didn`t tried to add a TEXT attribute ...

    Does anybody possibly know what could cause this problem?

  9. #29
    Join Date
    Oct 2005
    Location
    Finland
    Posts
    186
    Plugin Contributions
    1

    Default Re: Unique SKU for each attribute?

    There is some problems with this mod, and I never cared to track those down because I figured out it wasn't doing exactly what I needed anyway.

    I needed it to store the attributes SKU on the order, not just show it up, and fixed it in another way with a hack. Not perfect, and somehow risky, but it does the trick as long as there's only one dropdown.

    Now we're just waiting for 1.4 and a proper variant/attribute system. ;)

  10. #30
    Join Date
    Jan 2008
    Posts
    11
    Plugin Contributions
    0

    Default Re: Unique SKU for each attribute?

    Hi Rune,
    Could you show me how you did that?
    I desperately need that ...

 

 
Page 3 of 5 FirstFirst 12345 LastLast

Similar Threads

  1. Giving Each Attribute A Different Part or SKU Number
    By craftideasweekly in forum Setting Up Categories, Products, Attributes
    Replies: 9
    Last Post: 24 Jul 2014, 04:29 AM
  2. v139h Can I set a Unique ID for each product?
    By palpalani in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 9 Feb 2012, 08:31 AM
  3. Unique Model Number for each product attribute combo?
    By ksolito in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 30 May 2010, 08:30 PM
  4. Unique quantity for each attribute
    By Pengus in forum General Questions
    Replies: 2
    Last Post: 2 Jul 2009, 06:13 PM
  5. Unique SKUs for each product variation
    By moltar in forum General Questions
    Replies: 7
    Last Post: 29 May 2007, 03:42 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