Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Search
Search


Forum Index » Templates

Post new topic   Reply to topic
Magento Product attribute in Items by Quantity
View previous topic :: View next topic  
Author Message
fraternitee



Joined: 14 Oct 2011
Posts: 14

PostPosted: Fri Nov 25, 2011 6:50 pm    Post subject: Magento Product attribute in Items by Quantity Reply with quote

Is it possible to pull a custom attribute from my magento store and use that attribute in the Items by Quantity. I am basically wanting to build a pick list that would allow me to quickly pull the style and sizes i need.
Back to top
View user's profile Visit poster's website
Brett Berger
Site Admin


Joined: 11 Jun 2010
Posts: 2448

PostPosted: Fri Nov 25, 2011 7:44 pm    Post subject: Reply with quote

I believe the answer is yes but the setup is beyond my expertise, since I've never actually tried it myself. I see in our release notes that in v3.1.4.2988 (released 07/06/2011) there is a line that reads "Magento - Added examples to the module for how to include custom product attributes."

Take a look at the latest ShipWorks Magento Module File (shipworks3.php http://www.interapptive.com/shipworks/downloadcustomer.php?file=magento), edit the .php and find this code..

// Uncomment the following lines to include a custom product attribute in the downloaded data.
// These will appear as Order Item Attributes in ShipWorks.
//$product = Mage::getModel('catalog/product');
//$productId = $product->getIdBySku($sku);
//$product->load($productId);
//$value = $product->getAttributeText("attribute_code_here");
//if ($value)
//{
// // write the gift message as an attribute
// writeStartTag("Attribute");
// writeElement("Name", "Attribute_title_here");
// writeelement("Value", $value);
// writeCloseTag("Attribute");
//}

Hopefully that will get you started. Once you get them downloading successfully into ShipWorks then we would move on to "phase 2" Wink which would be to add them to the desired templates/reports.
_________________
Brett Berger
Interapptive ShipWorks Support
Back to top
View user's profile
fraternitee



Joined: 14 Oct 2011
Posts: 14

PostPosted: Fri Nov 25, 2011 8:13 pm    Post subject: Reply with quote

K looks to be all done.

I see my two attributes in the order items window.



now i have this block in my template.

Code:


  <tr>
                <xsl:if test="$showThumbnails">
                    <td style="width: 50px; {$orderDetailHeaderStyle};">Image</td>
                </xsl:if>
                <td style="{$orderDetailHeaderStyle}; white-space: nowrap;">Item Code</td>
                <td style="{$orderDetailHeaderStyle}; ">Name</td>
                <td style="{$orderDetailHeaderStyle}; ">Style</td>
                <td style="{$orderDetailHeaderStyle}; ">Size</td>
                <td style="{$orderDetailHeaderStyle};" align="right">Quantity</td>
                <td style="{$orderDetailHeaderStyle};" align="right">Total</td>

            </tr>


...

Code:
<td style="{$orderDetailContentStyle}; white-space: nowrap;"><xsl:value-of select="Code" /></td>
            <td style="{$orderDetailContentStyle};"><xsl:value-of select="Name" /></td>
            <td style="{$orderDetailContentStyle};"><xsl:value-of select="Style" /></td>
            <td style="{$orderDetailContentStyle};"><xsl:value-of select="Size" /></td>
            <td style="{$orderDetailContentStyle};" align="right"><xsl:value-of select="$groupQuantity" /></td>
            <td style="{$orderDetailContentStyle};" align="right">$<xsl:value-of select="format-number($groupTotal, '#,##0.00')" /></td>
   
Back to top
View user's profile Visit poster's website
Brett Berger
Site Admin


Joined: 11 Jun 2010
Posts: 2448

PostPosted: Sat Nov 26, 2011 7:01 am    Post subject: Reply with quote

The next question would be to figure out how to uniquely identify each item attribute. I'm assuming (hoping) that there will be an XML attribute that will help; so that we don't have to parse the text, say with a sub-string before and look for "Sytle:" or a sub-string after command looking for "Size:" etc. If we have to parse it, becomes significantly more complex, typically speaking.

Reply back with some XML Source code from ShipWorks so I can get an idea of how your data comes down from Magento in this case.

Highlight an order or two that have item attribute details > click Output > Save and Open > choose (all the way at the bottom) System\XML Source report > copy and paste the item details here in a reply so we can take a look.
_________________
Brett Berger
Interapptive ShipWorks Support
Back to top
View user's profile
dustyabe



Joined: 22 Feb 2012
Posts: 1

PostPosted: Wed Feb 22, 2012 9:19 pm    Post subject: Reply with quote

fraternitee,

I am currently trying to implement a new attribute into shipworks but I am having issues getting the code within the shipworks3.php file setup correctly. Can you please post an example of the actual code created?
_________________
Dustyabe
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic     Forum Index » Templates All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  

Powered by phpBB © 2001, 2002 phpBB Group