当前位置: 首页>>代码示例>>PHP>>正文


PHP PaymentModule::getModuleIdByName方法代码示例

本文整理汇总了PHP中PaymentModule::getModuleIdByName方法的典型用法代码示例。如果您正苦于以下问题:PHP PaymentModule::getModuleIdByName方法的具体用法?PHP PaymentModule::getModuleIdByName怎么用?PHP PaymentModule::getModuleIdByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PaymentModule的用法示例。


在下文中一共展示了PaymentModule::getModuleIdByName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildXMLOrder


//.........这里部分代码省略.........
     $alldownloadables = true;
     foreach ($products as $product) {
         //check if the visited product is downloadable and update the boolean value
         $alldownloadables = $alldownloadables && strlen($product['download_hash']) > 0;
         //gets the main product category
         $product_categories = Product::getProductCategories((int) $product['product_id']);
         $product_category = array_pop($product_categories);
         //initilization of the element <produit ...>
         $xml_element_product = new CertissimXMLElement("<produit></produit>");
         //gets the product certissim category (depends on PS version)
         if (_PS_VERSION_ >= '1.5' && Shop::isFeatureActive()) {
             $product_type = Configuration::get('CERTISSIM' . $product_category . '_PRODUCT_TYPE', null, null, $order->id_shop);
         } else {
             $product_type = Configuration::get('CERTISSIM' . $product_category . '_PRODUCT_TYPE');
         }
         //if a certissim category is set: the type attribute takes the product certissim type value
         if ($product_type) {
             $xml_element_product->addAttribute('type', Configuration::get('CERTISSIM' . $product_category . '_PRODUCT_TYPE', null, null, $order->id_shop));
         } else {
             //if certissim category not set: the type attribute takes the default value
             $xml_element_product->addAttribute('type', $default_product_type);
         }
         //sets the product reference that will be inserted into the XML stream
         //uses the product name by default
         $product_ref = $product['product_name'];
         //prefers ean13 if defined
         if (!empty($product['product_ean13'])) {
             $product_ref = $product['product_ean13'];
         }
         //prefers local reference if defined
         if (!empty($product['product_reference'])) {
             $product_ref = $product['product_reference'];
         }
         //adds attributes ref, nb, prixunit, and sets the value of the element <product> with the product name
         $xml_element_product->addAttribute('ref', CertissimTools::normalizeString($product_ref));
         $xml_element_product->addAttribute('nb', $product['product_quantity']);
         $xml_element_product->addAttribute('prixunit', $product['total_price']);
         $xml_element_product->setValue($product['product_name']);
         //adds the element <product> to the element <list>
         $xml_element_products_list->addProduit($xml_element_product);
     }
     if ($alldownloadables) {
         $real_carrier_type = '5';
     } elseif (_PS_VERSION_ >= '1.5' && Shop::isFeatureActive()) {
         //if selected carrier fianet type is defined, the type used will be the one got in the Configuration
         if (in_array(Configuration::get('CERTISSIM_' . (string) $carrier->id . '_CARRIER_TYPE', null, null, $order->id_shop), array_keys($this->_carrier_types))) {
             $real_carrier_type = Configuration::get('CERTISSIM_' . (string) $carrier->id . '_CARRIER_TYPE', null, null, $order->id_shop);
             $real_carrier_speed = Configuration::get('CERTISSIM_' . (string) $carrier->id . '_CARRIER_SPEED', null, null, $order->id_shop);
         } else {
             $real_carrier_type = Configuration::get('CERTISSIM_DEFAULT_CARRIER_TYPE', null, null, $order->id_shop);
             $real_carrier_speed = Configuration::get('CERTISSIM_DEFAULT_CARRIER_SPEED', null, null, $order->id_shop);
         }
     } elseif (in_array(Configuration::get('CERTISSIM_' . (string) $carrier->id . '_CARRIER_TYPE'), array_keys($this->_carrier_types))) {
         $real_carrier_type = Configuration::get('CERTISSIM_' . (string) $carrier->id . '_CARRIER_TYPE');
         $real_carrier_speed = Configuration::get('CERTISSIM_' . (string) $carrier->id . '_CARRIER_SPEED');
     } else {
         $real_carrier_type = Configuration::get('CERTISSIM_DEFAULT_CARRIER_TYPE');
         $real_carrier_speed = Configuration::get('CERTISSIM_DEFAULT_CARRIER_SPEED');
     }
     //initialization of the element <transport>
     $xml_element_carrier = new CertissimTransport($real_carrier_type, $alldownloadables ? 'Téléchargement' : Tools::htmlentitiesUTF8($carrier->name), $alldownloadables ? '1' : $real_carrier_speed, null);
     //find the id of the payment module used (depends on the PS version)
     if (_PS_VERSION_ >= '1.5') {
         $id_payment_module = PaymentModule::getModuleIdByName($order->module);
     } else {
         $payment_module = Module::getInstanceByName($order->module);
         $id_payment_module = $payment_module->id;
     }
     //initialization of the element <paiement>
     if (_PS_VERSION_ >= '1.5' && Shop::isFeatureActive()) {
         $payment_type = $this->_payment_types[Configuration::get('CERTISSIM_' . $id_payment_module . '_PAYMENT_TYPE', null, null, $order->id_shop)];
     } else {
         $payment_type = $this->_payment_types[Configuration::get('CERTISSIM_' . $id_payment_module . '_PAYMENT_TYPE')];
     }
     $xml_element_payment = new CertissimPaiement($payment_type);
     //initialization of the element <stack>
     $stack = new CertissimXMLElement("<stack></stack>");
     //agregates each elements in a main stream
     $xml_element_invoice_customer->childSiteconso($xml_element_invoice_customer_stats);
     $xml_element_control->childUtilisateur($xml_element_invoice_customer);
     $xml_element_control->childAdresse($xml_element_invoice_address);
     if (isset($xml_element_delivery_customer)) {
         $xml_element_control->childUtilisateur($xml_element_delivery_customer);
     }
     if (isset($xml_element_delivery_address)) {
         $xml_element_control->childAdresse($xml_element_delivery_address);
     }
     $xml_element_order_details->childTransport($xml_element_carrier);
     $xml_element_order_details->childList($xml_element_products_list);
     $xml_element_control->childInfocommande($xml_element_order_details);
     $xml_element_control->childPaiement($xml_element_payment);
     //add CDATA sections to protect against encoding issues
     $xml_element_control->addCdataSections();
     //add the <control> element into <stack>
     $stack->childControl($xml_element_control);
     CertissimLogger::insertLog(__METHOD__ . ' : ' . __LINE__, "---- flux généré pour commande {$id_order} ----");
     CertissimLogger::insertLog(__METHOD__ . ' : ' . __LINE__, $xml_element_control->getXML());
     CertissimLogger::insertLog(__METHOD__ . ' : ' . __LINE__, "---------------------------------------");
     return $stack;
 }
开发者ID:juniorhq88,项目名称:PrestaShop-modules,代码行数:101,代码来源:fianetfraud.php


注:本文中的PaymentModule::getModuleIdByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。