Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Help with Attributes
 
neuro
Sr. Member
 
Avatar
Total Posts:  104
Joined:  2008-09-29
France
 

Hi guyz.

I need to display in invoices an attribute but I can only print a constant variable..

I added a row but it display on each lines the attribute name with this snippet (Default.php in invoices):

$page->drawText(Mage::helper(’catalog’)->__(’conditionnement’), 460, $pdf->y, ‘UTF-8’);

It will display CONDITIONNEMENT on all results but I need the $var ^^

Thanks &
Merry Christmas all!

 
Magento Community Magento Community
Magento Community
Magento Community
 
neuro
Sr. Member
 
Avatar
Total Posts:  104
Joined:  2008-09-29
France
 

Why I can’t use

$page->drawText($_item->getAttributeText('couleur'), 460$pdf->y'UTF-8');

My output looks :
�������$��j�@D�|ŖI�,�� !��B�`��4�.�݊�*��}"���7�#n��О�%���ї�D�$���ƭ����t�6� w~�J���W ��b�Zʳf��:g�P\Y��{P��]�|���� �����0�ّW>�?�=��l�ߖy���v������������W(����

When i add

$page->drawText($item->getQty()*1435$pdf->y'UTF-8');
It’s works but with qty values ^^

I’d see that but I dunno ...
http://docs.magentocommerce.com/Mage_Catalog/Mage_Catalog_Model_Product.html#methodgetAttributeText

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageParts
Guru
 
Avatar
Total Posts:  415
Joined:  2007-11-18
 

These parts of Magento are still new to me, but it looks like you have got a charset error my friend.

You could try:

$page->drawText(utf8_encode($_item->getAttributeText('couleur')), 460$pdf->y'UTF-8');

Hope it helps smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
neuro
Sr. Member
 
Avatar
Total Posts:  104
Joined:  2008-09-29
France
 

Many thanks, but I have another bad output.

With

$page->drawText($_item->getAttributeText('couleur'), 460$pdf->y'UTF-8');
->
‹������$±jÃ@Dû|Å–I‘,Nç !ÁàBÄ`ÿÀž4’.ÜÝŠÕ*øó}"ͯ˜7Ó#nŸšÐžÄ%ÌÔíÑ—¤D®$”‘ŒÆ­ôµÐÿt·6Ç w~¡J…Š–W ¿èb¡Zʳf°©:g™P\Y–…{PÃÀ]¥|•„•» ÿØ�ãË0òÙ‘W>—?=ø£lÉß–yÙçí¾vÉáý¸£æÿÊ��ÿÿ�¡f`ÂÒ���

With

$page->drawText(utf8_encode($_item->getAttributeText('couleur')), 460$pdf->y'UTF-8');
->
‹������$±jÃ@Dû|Å–I‘,NcB.DöìI#éÂÝ­X­‚?ß’Ã’LñŠy3M0âö© íI\ÁL­áÐ~}IJäJB9ÀhÃœJïQMðOw‹asÃœp÷çªT¨hyÕð‹Þ)ª¥<���ÿÿ�¿
 
Magento Community Magento Community
Magento Community
Magento Community
 
neuro
Sr. Member
 
Avatar
Total Posts:  104
Joined:  2008-09-29
France
 

Please help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
neuro
Sr. Member
 
Avatar
Total Posts:  104
Joined:  2008-09-29
France
 

Now it work with only one invoice (cause script use approx 500 mB of apache per invoice ohh & 10 minutes to print)

$products Mage::getModel('catalog/product')->getCollection();
//$product = Mage::getModel('catalog/product')->loadByAttribute('sku', $item->getSku(), array('row', 'shelf', 'bin')); 
//add the Attribute
$products->addAttributeToSelect(array('conditionnement'), 'inner');
//walk the collection
foreach($products as $product){
    
if ($item->getSku() == $product->getSku() ) {
        $aa 

        
"c="   $product->getconditionnement() . 
       
// "&d;=" . $product->getdimentions() ;
       // "Bin:"   . $product->getBin();
        
$page->drawText($aa,  400$pdf->y'UTF-8');
        break;
    
}
}

I need to optimize this script but can anyone help me?

 
Magento Community Magento Community
Magento Community
Magento Community
 
neuro
Sr. Member
 
Avatar
Total Posts:  104
Joined:  2008-09-29
France
 

Help tongue wink

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top