cancel
Showing results for 
Search instead for 
Did you mean: 

Get price of an order, by manufacturer or brand on MAGENTO

Get price of an order, by manufacturer or brand on MAGENTO

I am developing a module to receive commissions from companies that are selling in my Magento store. It is already working, but need to add a new feature that I'm not getting. I need to add an extra value in the commission, if the application of any company is greater than "X"

I did in a way that did not work:

foreach ($order->getAllVisibleItems() as $key => $item)
{
    $product = Mage::getModel('catalog/product')->load($item->getProductId());
    $price = $item->getPrice();
    $valor_comissao = (int)$product->getAttributeText('comissao_vendedor')/100;
    $comissao_valor2= $price-($price*$valor_comissao);
    $qty = $item->getQtyOrdered();
    $valor_pedido= ($price*$qty);
    if($valor_pedido > 150) {
        $comissao_valor= ($comissao_valor2*$qty-17);
    } else {
        $comissao_valor=($comissao_valor2*$qty-2);
    }
           $comissoes[] = array (
                                                    'Razao' => 'Produto '.$item->getName().' id '.$item->getProductId().' x '.$item->getQtyToInvoice().' sku: '. $item->getSku(),
                                                    'Login' => $product->getAttributeText('login'),
                                                    'ValorFixo' => $comissao_valor
                                                );
    }

then only if the product go from $ 150.00 the value is added and if you have two selections from costing $ 100.00, the value is not added. I need the value to be added if the entire order of the brand exceeds $ 150.00.

The logic that I'm trying to follow is as follows:

  • Taking the total value of the order
  • Filter by tags, ie total value of the order by brand
  • If the product is a brand that exceeded "x" and she has not yet received the additional value, add shipping

I wonder if someone has gone through something similar and could help me.

Grateful.