Esempio n. 1
0
 private function notifyMC($row, $info)
 {
     $session = JFactory::getSession();
     // Trigger plugin only if user comes from Mailchimp
     if (!$session->get('mc', '0')) {
         return;
     }
     $shop_name = $this->params->get("store_name", "Your shop");
     $shop_id = $this->params->get("store_id", 42);
     $akeebasubsLevel = FOFModel::getTmpInstance('Levels', 'AkeebasubsModel')->setId($row->akeebasubs_level_id)->getItem();
     $akeeba_subscription_name = $akeebasubsLevel->title;
     $products = array(0 => array("product_id" => $info['current']->akeebasubs_level_id, "sku" => "", "product_name" => $akeeba_subscription_name, "category_id" => 0, "category_name" => "", "qty" => 1.0, "cost" => $info['current']->gross_amount));
     CmcHelperEcom360::sendOrderInformations($shop_id, $shop_name, $info['current']->akeebasubs_subscription_id, $info['current']->gross_amount, $info['current']->tax_percent, 0.0, $products);
 }
Esempio n. 2
0
 private function notifyMC($row, $event)
 {
     $session = JFactory::getSession();
     // Trigger plugin only if user comes from Mailchimp
     if (!$session->get('mc', '0')) {
         return;
     }
     $shop_name = $this->params->get("store_name", "Your shop");
     $shop_id = $this->params->get("store_id", 42);
     // get the cat information
     $db = JFactory::getDbo();
     $sql = "SELECT * FROM #__categories WHERE id = " . $event->catid;
     $db->setQuery($sql);
     $cat = $db->loadObject();
     $products = array(0 => array("product_id" => $event->id, "sku" => $event->semnum, "product_name" => $event->title, "category_id" => $event->catid, "category_name" => $cat->title, "qty" => $row->nrbooked, "cost" => $event->fee));
     CmcHelperEcom360::sendOrderInformations($shop_id, $shop_name, $row->id, $row->payment_brutto, $row->payment_tax, 0.0, $products);
 }
Esempio n. 3
0
 /**
  * @param        $cart
  * @param        $orderresult
  * @param string $type
  *
  * @return mixed
  */
 public function notifyMC($cart, $orderresult, $type = "new")
 {
     $session = JFactory::getSession();
     // Trigger plugin only if user comes from Mailchimp
     if (!$session->get('mc', '0')) {
         return false;
     }
     $shop_name = $this->params->get("store_name", "Your shop");
     $shop_id = $this->params->get("store_id", 42);
     $products = array();
     for ($i = 0; $i < $cart["idx"]; $i++) {
         $prod = $cart[$i];
         $prodInfo = $this->getProductInfo($prod['product_id']);
         $product_name = $prodInfo->product_name;
         $category_name = $prodInfo->category_name;
         $products[] = array("product_id" => $prod['product_id'], "sku" => "", "product_name" => $product_name, "category_id" => $prod['category_id'], "category_name" => $category_name, "qty" => $prod['quantity'], "cost" => $prod['product_price']);
     }
     return CmcHelperEcom360::sendOrderInformations($shop_id, $shop_name, $orderresult->order_id, $cart['total'], $cart['tax'], $cart['shipping'], $products);
 }
Esempio n. 4
0
 /**
  *
  * @param $order
  *
  * @return void
  * @internal param $data
  */
 function notifyMC($order)
 {
     $session = JFactory::getSession();
     // Trigger plugin only if user comes from Mailchimp
     if (!$session->get('mc', '0')) {
         return;
     }
     $shop_name = $this->params->get("store_name", "Your shop");
     $shop_id = $this->params->get("store_id", 42);
     foreach ($order->cart->products as $product) {
         $category = "";
         // Todo query for it
         $products[] = array("product_id" => $product->product_id, "sku" => "", "product_name" => $product->order_product_code, "category_id" => 0, "category_name" => $category, "qty" => $product->order_product_quantity, "cost" => $product->order_product_price + $product->order_product_tax);
     }
     $shipping = 0;
     if ($order->order_shipping_price != null) {
         $shipping = $order->order_shipping_price;
     }
     CmcHelperEcom360::sendOrderInformations($shop_id, $shop_name, $order->order_id, $order->cart->full_total->prices[0]->price_value_with_tax, $order->cart->full_total->prices[0]->price_value_with_tax - $order->cart->full_total->prices[0]->price_value, $shipping, $products);
 }
Esempio n. 5
0
 /**
  * @param $cart
  * @param $order
  *
  * @return bool
  */
 public function plgVmConfirmedOrder($cart, $order)
 {
     $app = JFactory::getApplication();
     // This plugin is only intended for the frontend
     if ($app->isAdmin()) {
         return true;
     }
     $session = JFactory::getSession();
     // Trigger plugin only if user comes from Mailchimp
     if (!$session->get('mc', '0')) {
         return;
     }
     $shop_name = $this->params->get("store_name", "Your shop");
     $shop_id = $this->params->get("store_id", 42);
     $products = array();
     foreach ($order['items'] as $item) {
         $products[] = array("product_id" => $item->virtuemart_product_id, "sku" => $item->order_item_sku, "product_name" => $item->order_item_name, "category_id" => $item->virtuemart_category_id, "category_name" => "", "qty" => (double) $item->product_quantity, "cost" => $item->product_final_price);
     }
     return CmcHelperEcom360::sendOrderInformations($shop_id, $shop_name, $order["details"]["BT"]->virtuemart_order_id, $order["details"]["BT"]->order_total, $order["details"]["BT"]->order_tax, $order["details"]["BT"]->order_shipment, $products);
 }
Esempio n. 6
0
 /**
  *
  * @param $data
  */
 public function notifyMC($data)
 {
     $session = JFactory::getSession();
     // Trigger plugin only if user comes from Mailchimp
     if (!$session->get('mc', '0')) {
         return;
     }
     $shop_name = $this->params->get("store_name", "Your shop");
     $shop_id = $this->params->get("store_id", 42);
     // with each order you can subscribe to only 1 subscription. But there is no getPlan function
     $plans = $data->getPlans();
     $total = $data->getPrice();
     $tax = 0;
     // get the invoice information - otherwise we have no tax information for the purchase
     $invoice = $data->getOrder(true)->getInvoice();
     if ($invoice) {
         $total = $invoice->getTotal();
         $tax = $invoice->getTaxAmount();
     }
     $products = array(0 => array("product_id" => $plans[0], "sku" => $plans[0], "product_name" => $data->getTitle(), "qty" => 1, "cost" => $data->getPrice()));
     CmcHelperEcom360::sendOrderInformations($shop_id, $shop_name, $data->getId(), $total, $tax, 0.0, $products);
 }