public function render(Varien_Object $row)
 {
     if ($row->getAction()) {
         return;
     }
     $productId = $row->getParentId() ? $row->getParentId() : $row->getEntityId();
     $stockHistoryUrl = $this->getUrl('inventoryreportsadmin/adminhtml_product/chart', array('id' => $productId));
     $html = "<a href='' onclick='window.open( " . "\"" . $stockHistoryUrl . "\"" . "," . "\"" . $this->__('Stock History') . "\"" . "," . "\"" . 'scrollbars=yes, resizable=yes, width=520, height=540, top=50, left=300' . "\"" . "); " . "return false;' target='_blank'>" . $this->__('Stock History') . '</a>';
     return $html;
 }
 public function render(Varien_Object $row)
 {
     if ($row->getAction()) {
         return;
     }
     //get row order ids
     $purchaseorderIds = $row->getAllPurchaseOrderId();
     $filter .= 'purchaseorderids=' . $purchaseorderIds;
     $filter = base64_encode($filter);
     $orderUrl = Mage::helper("adminhtml")->getUrl('inventoryreportsadmin/adminhtml_inventoryreports/purchaseorder', array('top_filter' => $filter, '_secure' => Mage::app()->getStore()->isCurrentlySecure()));
     $html .= "<a href='' onclick='window.open( " . "\"" . $orderUrl . "\"" . "," . "\"" . $this->__('Order List') . "\"" . "," . "\"" . 'scrollbars=yes, resizable=yes, width=1000, height=600, top=50, left=300' . "\"" . "); " . "return false;' target='_blank'>" . $this->__('View Orders List') . "</a>";
     //show only in report by sku
     if ($this->getColumn()->getGrid()->isPOSKUReport()) {
         $productId = $row->getParentId() ? $row->getParentId() : $row->getProductId();
         $stockHistoryUrl = $this->getUrl('inventoryreportsadmin/adminhtml_product/chart', array('id' => $productId));
         $html = "<a href='' onclick='window.open( " . "\"" . $stockHistoryUrl . "\"" . "," . "\"" . $this->__('Stock History') . "\"" . "," . "\"" . 'scrollbars=yes, resizable=yes, width=520, height=540, top=50, left=300' . "\"" . "); " . "return false;' target='_blank'>" . $this->__('Stock History') . '</a> <br/>' . $html;
     }
     return $html;
 }
Example #3
0
 /**
  * Retrieve category parent path
  *
  * @param Varien_Object $category
  * @return string
  */
 public function getCategoryParentPath(Varien_Object $category)
 {
     $store = Mage::app()->getStore($category->getStoreId());
     if ($category->getId() == $store->getRootCategoryId()) {
         return '';
     } elseif ($category->getParentId() == 1 || $category->getParentId() == $store->getRootCategoryId()) {
         return '';
     }
     $parentCategory = $this->getCategory($category->getParentId(), $store->getId());
     return $parentCategory->getUrlPath() . '/';
 }
Example #4
0
 private function _getProductInformationWork($item, $getInfo, $hasChildren, $children)
 {
     $getProduct = in_array('product', $getInfo);
     $getImage = in_array('image_url', $getInfo);
     $getLink = in_array('product_url', $getInfo);
     $result = new Varien_Object();
     $result->setProductId((int) $item->getProductId());
     $result->setIsConfigurable(false);
     $result->setIsBundle(false);
     $result->setSku($item->getSku());
     if (Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE == $item->getProductType() && $hasChildren) {
         $result->setIsConfigurable(true);
         $result->setParentId($result->getProductId());
         $result->setProductId((int) $children[0]->getProductId());
     }
     if (Mage_Catalog_Model_Product_Type::TYPE_BUNDLE == $item->getProductType() && $hasChildren) {
         $result->setIsBundle(true);
         $product = Mage::getModel('catalog/product')->load($result->getProductId());
         $result->setSku($product->getSku());
         $result->setProduct($product);
     } else {
         if ($getProduct || $getImage || $getLink && !$result->getIsConfigurable()) {
             $result->setProduct(Mage::getModel('catalog/product')->load($result->getProductId()));
         }
     }
     if ($getLink) {
         $result->setProductUrl($this->getProductUrl($result->getIsConfigurable() ? Mage::getModel('catalog/product')->load($result->getParentId()) : $result->getProduct()));
     }
     if ($getImage) {
         $result->setImageUrl($this->getProductImage($result['product']));
     }
     return $result;
 }
Example #5
0
 public function EnviaGateway(Varien_Object $payment, $xml)
 {
     /*
      * Faz o envio do XML para o gateway de pagamento.
      */
     $status = "";
     $orderId = $payment->getParentId();
     $url = 'https://www.akatus.com/api/v1/carrinho.xml';
     #$url = 'https://dev.akatus.com/api/v1/carrinho.xml';
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_URL, $url);
     #curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
     # curl_setopt($curl, CURLOPT_USERPWD, $user . ":" . $passwd);
     curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0");
     curl_setopt($curl, CURLOPT_POST, true);
     curl_setopt($curl, CURLOPT_POSTFIELDS, $xml);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
     $ret = curl_exec($curl);
     $err = curl_error($curl);
     curl_close($curl);
     $data = $this->xml2array($ret);
     #Criado para facilitar o ambiente de depuração.
     if ($this->getConfigData('module_debug') == '1') {
         Mage::throwException("XML RECEBIDO:\n\n" . $ret . "\n\n\nXML Enviado:\n" . $xml);
     }
     Mage::Log("..:: ENVIADO ::..\n\n" . $xml . "\n\n ..:: RECEBIDO ::..\n\n" . $ret);
     /*
     print_r($ret);
     print_r($data);	
     */
     //echo "<br />Status:".$data["resposta"]["status"]["value"];
     $info = $this->getInfoInstance();
     $formapagamento = $info->getCheckFormapagamento();
     //print_r($formadepagamento);
     //exit();
     if ($data["resposta"]["status"]["value"] == "erro") {
         #exibe a mensagem de erro
         Mage::Log('Deu erro meu velho: ' . $data["resposta"]["descricao"]["value"]);
         Mage::throwException("Não foi possível realizar sua transação");
         #exibe a mensagem de erro
         #Mage::getSingleton('checkout/session')->addError(Mage::helper('checkout')->__("Não foi possivel realizar sua transação"));
     } else {
         //echo "Não deu erro, retornou algum outro status";
         if ($data["resposta"]["status"]["value"] == "Em Análise") {
             //echo "Em análise";
             //exit;
             //Salva no sistema o ID da transação
             Mage::Log('Veio Em Análise, passou o cartão, é setar o status e partir pro abraço.');
             try {
                 $transacaoId = $data["resposta"]["transacao"]["value"];
                 $this->SalvaIdTransacao($orderId, $transacaoId);
                 $order = Mage::getModel('sales/order')->load($orderId);
                 $order->setStatus('pending_payment');
                 $order->save();
                 $info = $this->getInfoInstance();
                 $formadepagamento = $info->getCheckFormapagamento();
                 //Mage::throwException($formadepagamento);
                 //Mage::throwException("Seu pedido foi realizado com sucesso. Estamos aguardando a confirmação de sua administradora e assim que o pagamento for liberado enviaremos o produto");
                 $msg = "Seu pedido foi realizado com sucesso. Estamos aguardando a confirmação de sua administradora e assim que o pagamento for liberado enviaremos o produto";
                 Mage::getSingleton('checkout/session')->addSuccess(Mage::helper('checkout')->__($msg));
             } catch (Exception $e) {
                 $e->getMessage();
             }
         } elseif ($data["resposta"]["status"]["value"] == "Aguardando Pagamento" || $data["resposta"]["status"]["value"] == "Processando") {
             $info = $this->getInfoInstance();
             $formapagamento = $info->getCheckFormapagamento();
             //ge::throwException($formadepagamento);
             //$url_destino='https://www.akatus.com/boleto/';
             if ($formapagamento == "boleto") {
                 #$url_destino='https://dev.akatus.com/boleto/';
                 $url_destino = 'https://www.akatus.com/boleto/';
                 $str = $data['resposta']['transacao']['value'];
                 $url_destino .= base64_encode($str) . '.html';
                 $payment->setCheckBoletourl($url_destino);
                 $payment->save();
                 $transacaoId = $data["resposta"]["transacao"]["value"];
                 $this->SalvaIdTransacao($orderId, $transacaoId);
                 #monta a mensagem
                 #$msg="<img src =
                 $msg = 'Transação realizada com sucesso. Clique na url abaixo para imprimir seu boleto.<br/>';
                 $msg .= "<a href='" . $url_destino . "' target='_blank'>" . $url_destino . "</a>";
                 Mage::getSingleton('checkout/session')->addSuccess(Mage::helper('checkout')->__($msg));
             }
             if ($formapagamento == "tef") {
                 #$url_destino='https://dev.akatus.com/tef/';
                 $url_destino = 'https://www.akatus.com/tef/';
                 $str = $data['resposta']['transacao']['value'];
                 $url_destino .= base64_encode($str) . '.html';
                 $transacaoId = $data["resposta"]["transacao"]["value"];
                 $this->SalvaIdTransacao($orderId, $transacaoId);
                 #monta a mensagem
                 $msg = 'Transação realizada com sucesso. Clique na url abaixo e você será redirecionado para seu banco.<br/>';
                 $msg .= "<a href='" . $url_destino . "' target='_blank'>" . $url_destino . "</a>";
                 Mage::getSingleton('checkout/session')->addSuccess(Mage::helper('checkout')->__($msg));
             }
         } else {
             //			$info = $this->getInfoInstance();
             //         $formapagamento=$info->getCheckFormapagamento();
             Mage::throwException("Pagamento não autorizado. Consulte sua operadora para maiores informações.");
             //$msq = "Pagamento não autorizado. Consulte sua operadora para maiores informações.";
             //Mage::throwException("Cartão Recusado:".$data["resposta"]["status"]["value"]."<br />Forma de pagamento:".$formadepagamento);
         }
     }
 }