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-me Please Configurable Product
 
Thiago Trivelato
Member
 
Avatar
Total Posts:  52
Joined:  2008-05-13
Brasil
 

Hello, everyone, my question is this, I made a payment method similar to the Brazilian paypal, but I need to add items in descição the product if a product configurable, already tried several ways.

Here is a piece of code you wish:

$items = $this->getQuote()->getAllItems();

if ($items) {
$i = 1;
foreach($items as $item){
if ($item->getParentItem()) {
continue;
}

$sArr = array_merge($sArr, array(
‘item_descr_’.$i => $this->transformaDescricao($this->removeAcentos($item->getName())),
‘item_id_’.$i => $item->getProduct()->getId()."_".$i,
‘item_quant_’.$i => round($item->getQty()),
‘item_peso_’.$i => $this->transformaPeso($item->getWeight()),
‘item_frete_’.$i => $this->getData(’some_attribute_name’),
‘item_valor_’.$i => $this->transformaPreco(($item->getBaseCalculationPrice()-$item->getBaseDiscountAmount()))
));

if($item->getBaseTaxAmount()>0){
$sArr = array_merge($sArr, array(
‘tax_’.$i => sprintf(’%.2f’,$item->getBaseTaxAmount()),
));
}

$i++;
}
}

When the product is configurable he has some kind of atibuto, PM example shirt or G, and I wanted cosneguir get this data within the product (class), so that I am not able, someone help me?

Here I made some tests without success:

$teste1 = $item->getProduct()->getOptions();

$teste2 = array();
foreach($teste1 as $valorteste) {
foreach($valorteste->getValues()as $valor3) {
$teste2[] = $valor3->getTitle();
}
}

I need something like:

<input type="hidden" name="item_id_1" value="12345">
<input type="hidden" name="item_descr_1" value="Description 1 - G*”>
<input type="hidden" name="item_quant_1" value="1">
<input type="hidden" name="item_price_1" value="100">
<input type="hidden" name="item_ship_1" value="0">
<input type="hidden" name="item_weight_1" value="0">

<input type="hidden" name="item_id_1" value="12345">
<input type="hidden" name="item_descr_1" value="Description 1 - M*”>
<input type="hidden" name="item_quant_1" value="1">
<input type="hidden" name="item_price_1" value="100">
<input type="hidden" name="item_ship_1" value="0">
<input type="hidden" name="item_weight_1" value="0">

<input type="hidden" name="item_id_1" value="12345">
<input type="hidden" name="item_descr_1" value="Description 1 - P*”>
<input type="hidden" name="item_quant_1" value="1">
<input type="hidden" name="item_price_1" value="100">
<input type="hidden" name="item_ship_1" value="0">
<input type="hidden" name="item_weight_1" value="0">

*This is the attribute of the product configurable

Do you have any tips?
Thank you

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