コード例 #1
0
 /**
  * Getting The end javascript
  *
  * @return string
  */
 protected function _getEndJs()
 {
     $companyArray = PriceMatcher::getAllCompaniesForPriceMatching();
     if (count(array_keys($companyArray)) === 0) {
         die('No Price Match Company Set up. Please set up the Price Matching companies before using this page!!!!!');
     }
     $js = parent::_getEndJs();
     // Setup the dnd listeners.
     $js .= 'pageJs.setCallbackId("getAllPricesForProduct", "' . $this->getAllPricesForProductBtn->getUniqueID() . '")';
     $js .= '.load("price_match_div", ' . json_encode($companyArray) . ');';
     return $js;
 }
コード例 #2
0
 /**
  * Getting price matching information
  *
  * @param unknown $sender
  * @param unknown $param
  */
 public function priceMatching($sender, $param)
 {
     $results = $errors = array();
     try {
         $id = isset($param->CallbackParameter->id) ? $param->CallbackParameter->id : '';
         $product = Product::get($id);
         $prices = ProductPrice::getPrices($product, ProductPriceType::get(ProductPriceType::ID_RRP));
         $companies = PriceMatcher::getAllCompaniesForPriceMatching();
         $prices = PriceMatcher::getPrices($companies, $product->getSku(), count($prices) === 0 ? 0 : $prices[0]->getPrice());
         $myPrice = $prices['myPrice'];
         $minPrice = $prices['minPrice'];
         $msyPrice = $prices['companyPrices']['MSY'];
         $prices['id'] = $id;
         $results = $prices;
     } catch (Exception $ex) {
         $errors[] = $ex->getMessage();
     }
     $param->ResponseData = StringUtilsAbstract::getJson($results, $errors);
 }