Example #1
0
 $commande->setVar('cmd_text', implode("\n", $discountsDescription));
 $res = $h_oledrion_commands->insert($commande, true);
 if (!$res) {
     oledrion_utils::redirect(_OLEDRION_ERROR10, OLEDRION_URL, 6);
 }
 // Enregistrement du panier
 $msgCommande = '';
 $handlers = oledrion_handler::getInstance();
 foreach ($cartForTemplate as $line) {
     $panier = $h_oledrion_caddy->create(true);
     $panier->setVar('caddy_product_id', $line['product_id']);
     $panier->setVar('caddy_qte', $line['product_qty']);
     $panier->setVar('caddy_price', oledrion_utils::formatFloatForDB($line['totalPrice']));
     // Attention, prix TTC avec frais de port
     $panier->setVar('caddy_cmd_id', $commande->getVar('cmd_id'));
     $panier->setVar('caddy_shipping', oledrion_utils::formatFloatForDB($line['discountedShipping']));
     $panier->setVar('caddy_pass', md5(xoops_makepass()));
     // Pour le téléchargement
     $msgCommande .= str_pad(wordwrap($line['product_title'], 60), 60, ' ') . ' ' . str_pad($line['product_qty'], 8, ' ', STR_PAD_LEFT) . ' ' . str_pad($line['totalPriceFormated'], 10, ' ', STR_PAD_LEFT) . ' ' . str_pad($line['discountedShipping'], 10, ' ', STR_PAD_LEFT) . "\n";
     $res = $h_oledrion_caddy->insert($panier, true);
     // Attributs
     if ($res && is_array($line['attributes']) && count($line['attributes']) > 0) {
         // Enregistrement des attributs pour ce produit
         foreach ($line['attributes'] as $attributeId => $attributeInformation) {
             $caddyAttribute = $handlers->h_oledrion_caddy_attributes->create(true);
             $caddyAttribute->setVar('ca_cmd_id', $commande->getVar('cmd_id'));
             $caddyAttribute->setVar('ca_caddy_id', $panier->getVar('caddy_id'));
             $caddyAttribute->setVar('ca_attribute_id', $attributeId);
             $selectedOptions = $attributeInformation['attribute_options'];
             $msgCommande .= '- ' . $attributeInformation['attribute_title'] . "\n";
             foreach ($selectedOptions as $selectedOption) {
Example #2
0
 $commande->setVar('cmd_location_id', $cmd_location_id);
 $commande->setVar('cmd_delivery', $cmd_delivery);
 $commande->setVar('cmd_delivery_id', $cmd_delivery_id);
 $commande->setVar('cmd_payment', $cmd_payment);
 $commande->setVar('cmd_payment_id', $cmd_payment_id);
 $commande->setVar('cmd_status', 2);
 $commande->setVar('cmd_track', $cmd_track);
 $commande->setVar('cmd_gift', $cmd_gift);
 $res1 = $h_oledrion_commands->insert($commande, true);
 // Save caddy
 $caddy = $h_oledrion_caddy->create(true);
 $caddy->setVar('caddy_product_id', $product_id);
 $caddy->setVar('caddy_qte', $product->getVar('product_qty'));
 $caddy->setVar('caddy_price', oledrion_utils::formatFloatForDB($cmd_total));
 $caddy->setVar('caddy_cmd_id', $commande->getVar('cmd_id'));
 $caddy->setVar('caddy_shipping', oledrion_utils::formatFloatForDB($cmd_shipping));
 $caddy->setVar('caddy_pass', md5(xoops_makepass()));
 $res2 = $h_oledrion_caddy->insert($caddy, true);
 // Attributs
 /* if ($res2 && is_array($attributes) && count($attributes) > 0) {
        foreach ($attributes as $attributeId => $attributeInformation) {
            $caddyAttribute = $handlers->h_oledrion_caddy_attributes->create(true);
            $caddyAttribute->setVar('ca_cmd_id', $commande->getVar('cmd_id'));
            $caddyAttribute->setVar('ca_caddy_id', $caddy->getVar('caddy_id'));
            $caddyAttribute->setVar('ca_attribute_id', $attributeId);
            $selectedOptions = $attributeInformation['attribute_options'];
            $msgCommande .= '- ' . $attributeInformation['attribute_title'] . "\n";
            foreach ($selectedOptions as $selectedOption) {
                $caddyAttribute ->addOption($selectedOption['option_name'], $selectedOption['option_value'], $selectedOption['option_price']);
                $msgCommande .= '    ' . $selectedOption['option_name'] . ' : ' . $selectedOption['option_ttc_formated'] . "\n";
            }
Example #3
0
 /**
  * Retourne les éléments du produits formatés pour affichage
  *
  * @param  string $format Le format à utiliser
  * @return array  Les informations formatées
  */
 public function toArray($format = 's')
 {
     $ret = array();
     $ret = parent::toArray($format);
     $oledrion_Currency = oledrion_Currency::getInstance();
     $ttc = $finalPriceTTC = $this->getTTC();
     $finalPriceHT = floatval($this->getVar('product_price'));
     $ret['product_ecotaxe_formated'] = $oledrion_Currency->amountForDisplay($this->getVar('product_ecotaxe'));
     $ret['product_price_formated'] = $oledrion_Currency->amountForDisplay($this->getVar('product_price', 'e'));
     $ret['product_shipping_price_formated'] = $oledrion_Currency->amountForDisplay($this->getVar('product_shipping_price', 'e'));
     $ret['product_discount_price_formated'] = $oledrion_Currency->amountForDisplay($this->getVar('product_discount_price', 'e'));
     $ret['product_price_ttc'] = $oledrion_Currency->amountForDisplay($ttc);
     $ret['product_price_ttc_long'] = $oledrion_Currency->amountForDisplay($ttc, 'l');
     if (intval($this->getVar('product_discount_price')) > 0) {
         //geeker
         $finalPriceTTC = $this->getDiscountTTC();
         $finalPriceHT = floatval($this->getVar('product_discount_price', 'e'));
         $ret['product_discount_price_ttc'] = $oledrion_Currency->amountForDisplay($this->getDiscountTTC());
         $ret['product_discount_price_ttc_long'] = $oledrion_Currency->amountForDisplay($this->getDiscountTTC(), 'l');
     } else {
         $ret['product_discount_price_ttc'] = '';
         $ret['product_discount_price_ttc_long'] = '';
     }
     // Les informations sur les attributs
     $attributesCount = $this->productAttributesCount();
     $ret['product_attributes_count'] = $attributesCount;
     if ($attributesCount > 0) {
         $optionsPrice = $this->getInitialOptionsPrice();
         $ret['product_price_formated'] = $oledrion_Currency->amountForDisplay(floatval($this->getVar('product_price', 'e')) + $optionsPrice);
         $ret['product_discount_price_formated'] = $oledrion_Currency->amountForDisplay(floatval($this->getVar('product_discount_price', 'e')) + $optionsPrice);
         $ret['product_price_ttc'] = $oledrion_Currency->amountForDisplay($ttc + $optionsPrice);
         $ret['product_price_ttc_long'] = $oledrion_Currency->amountForDisplay($ttc + $optionsPrice, 'l');
         if (intval($this->getVar('product_discount_price')) != 0) {
             $finalPriceTTC = $this->getDiscountTTC() + $optionsPrice;
             $finalPriceHT = floatval($this->getVar('product_discount_price', 'e')) + $optionsPrice;
             $ret['product_discount_price_ttc'] = $oledrion_Currency->amountForDisplay(floatval($this->getDiscountTTC()) + $optionsPrice);
             $ret['product_discount_price_ttc_long'] = $oledrion_Currency->amountForDisplay(floatval($this->getDiscountTTC()) + $optionsPrice, 'l');
         }
     }
     $ret['product_final_price_ht_formated_long'] = $oledrion_Currency->amountForDisplay($finalPriceHT, 'l');
     $ret['product_final_price_ttc'] = $finalPriceTTC;
     $ret['product_final_price_ttc_javascript'] = oledrion_utils::formatFloatForDB($finalPriceTTC);
     $ret['product_final_price_ttc_formated'] = $oledrion_Currency->amountForDisplay($finalPriceTTC);
     $ret['product_final_price_ttc_formated_long'] = $oledrion_Currency->amountForDisplay($finalPriceTTC, 'l');
     $ret['product_vat_amount_formated_long'] = $oledrion_Currency->amountForDisplay($finalPriceHT - $finalPriceTTC);
     $ret['product_tooltip'] = oledrion_utils::makeInfotips($this->getVar('product_description'));
     $ret['product_url_rewrited'] = $this->getLink();
     $ret['product_href_title'] = oledrion_utils::makeHrefTitle($this->getVar('product_title'));
     $ret['product_recommended'] = $this->isRecommended();
     $ret['product_recommended_picture'] = $this->recommendedPicture();
     $ret['product_image_full_url'] = $this->getPictureUrl();
     $ret['product_thumb_full_url'] = $this->getThumbUrl();
     $ret['product_image_full_path'] = $this->getPicturePath();
     $ret['product_thumb_full_path'] = $this->getThumbPath();
     $ret['product_shorten_summary'] = oledrion_utils::truncate_tagsafe($this->getVar('product_summary'), OLEDRION_SUMMARY_MAXLENGTH);
     $ret['product_shorten_description'] = oledrion_utils::truncate_tagsafe($this->getVar('product_description'), OLEDRION_SUMMARY_MAXLENGTH);
     $ret['product_new'] = $this->isNewProduct();
     return $ret;
 }