Esempio n. 1
0
 function plgVmOnProductDisplayPayment($product, &$productDisplay)
 {
     $vendorId = 1;
     if ($this->getPluginMethods($vendorId) === 0) {
         return false;
     }
     if (!class_exists('klarna_productPrice')) {
         require JPATH_VMKLARNAPLUGIN . DS . 'klarna' . DS . 'helpers' . DS . 'klarna_productprice.php';
     }
     if (!class_exists('VirtueMartCart')) {
         require JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php';
     }
     $cart = VirtueMartCart::getCart();
     foreach ($this->methods as $method) {
         $cData = KlarnaHandler::getcData($method, $this->getCartAddress($cart, $type, false));
         if ($cData) {
             $productPrice = new klarna_productPrice($cData);
             if ($productViewData = $productPrice->showProductPrice($product)) {
                 $productDisplayHtml = $this->renderByLayout('productprice_layout', $productViewData, $method->payment_element, 'payment');
                 $productDisplay[] = $productDisplayHtml;
             }
         }
     }
     return true;
 }
Esempio n. 2
0
	/**
	 * @param $product
	 * @param $productDisplay
	 * @return bool
	 */
	function plgVmOnProductDisplayPayment ($product, &$productDisplay) {

		$vendorId = 1;
		if ($this->getPluginMethods ($vendorId) === 0) {
			return FALSE;
		}
		if (!class_exists ('klarna_productPrice')) {
			require (JPATH_VMKLARNAPLUGIN . DS . 'klarna' . DS . 'helpers' . DS . 'klarna_productprice.php');
		}
		if (!class_exists ('VirtueMartCart')) {
			require(JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php');
		}
		$cart = VirtueMartCart::getCart ();

		foreach ($this->methods as $method) {
			$type = NULL;
			$cData = KlarnaHandler::getcData ($method, $this->getCartAddress ($cart, $type, FALSE));
			if ($cData['active'] and in_array ('part', $cData['payments_activated'])) {
				//if (!empty($product->prices)) { // no price is set
				if (!empty($product->prices['salesPrice'])) {
					$productPrice = new klarna_productPrice($cData);
					if ($productViewData = $productPrice->showProductPrice ($product, $cart)) {
						$productDisplayHtml = $this->renderByLayout ('productprice_layout', $productViewData, $method->payment_element, 'payment');
						$productDisplay[] = $productDisplayHtml;
					}
				}
			}
		}
		return TRUE;
	}