コード例 #1
0
 /**
  * @param $plugin
  *
  * @throws ShopgateLibraryException
  */
 public function __construct($plugin)
 {
     parent::__construct($plugin);
     /** @var CartCore $cart */
     $cart = new Cart();
     $cart->id_lang = $this->getPlugin()->getLanguageId();
     $cart->id_currency = $this->getPlugin()->getContext()->currency->id;
     $cart->recyclable = 0;
     $cart->gift = 0;
     $this->getPlugin()->getContext()->cart = $cart;
     /**
      * check / create shopgate carrier
      */
     /** @var CarrierCore $sgCarrier */
     $sgCarrier = new Carrier(Configuration::get('SG_CARRIER_ID'));
     if (!$sgCarrier->id) {
         $shopgateShippingModel = new ShopgateShipping(new ShopGate());
         $shopgateShippingModel->createShopgateCarrier();
     }
     /**
      * check all needed table columns
      */
     $shopGate = new ShopGate();
     if (!$shopGate->updateTables()) {
         throw new ShopgateLibraryException(ShopgateLibraryException::PLUGIN_DATABASE_ERROR, sprintf('Cannot update shopgate_order_table'));
     }
 }
コード例 #2
0
/**
 * @param ShopGate $module
 *
 * @return bool
 */
function upgrade_module_2_9_52($module)
{
    $shopgateCarrierId = Configuration::get('SG_CARRIER_ID');
    /**
     * set current shopgate carrier as deleted
     */
    if ($shopgateCarrierId) {
        /** @var CarrierCore $carrier */
        $carrier = new Carrier($shopgateCarrierId);
        $carrier->deleted = true;
        $carrier->save();
    }
    $shopgateShippingModel = new ShopgateShipping($module);
    $shopgateShippingModel->createShopgateCarrier();
    $module->updateTables();
    return true;
}
コード例 #3
0
 /**
  * @param ShopGate $module
  */
 public function __construct($module)
 {
     $this->module = $module;
     $dom = new DOMDocument();
     $dom->load(dirname(__FILE__) . '/../config/payment.xml');
     /** @var SimpleXmlElement $payments */
     $payments = simplexml_import_dom($dom);
     foreach ($payments as $payment) {
         $key = (string) $payment->key;
         $this->_methods[$key]['title'] = $this->module->l((string) $payment->name);
         $this->_methods[$key]['blocked'] = $this->_getPaymentState($payment, 'blocked', $payments);
         $this->_methods[$key]['blocked_paid'] = $this->_getPaymentState($payment, 'blocked_paid', $payments);
         $this->_methods[$key]['not_blocked_paid'] = $this->_getPaymentState($payment, 'not_blocked_paid', $payments);
         $this->_methods[$key]['not_blocked_not_paid'] = $this->_getPaymentState($payment, 'not_blocked_not_paid', $payments);
         $this->_methods[$key]['blocked_shipped'] = $this->_getPaymentState($payment, 'blocked_shipped', $payments);
         $this->_methods[$key]['not_blocked_shipped'] = $this->_getPaymentState($payment, 'not_blocked_shipped', $payments);
     }
 }
コード例 #4
0
 /**
  * @param ShopGate $module
  */
 public function __construct($module)
 {
     $this->shipping_service_list = array(ShopgateDeliveryNote::OTHER => $module->l('Other'), ShopgateDeliveryNote::DHL => $module->l('DHL'), ShopgateDeliveryNote::DHLEXPRESS => $module->l('DHL Express'), ShopgateDeliveryNote::DP => $module->l('Deutsche Post'), ShopgateDeliveryNote::DPD => $module->l('DPD'), ShopgateDeliveryNote::FEDEX => $module->l('FedEx'), ShopgateDeliveryNote::GLS => $module->l('GLS'), ShopgateDeliveryNote::HLG => $module->l('Hermes'), ShopgateDeliveryNote::TNT => $module->l('TNT'), ShopgateDeliveryNote::TOF => $module->l('trans-o-flex'), ShopgateDeliveryNote::UPS => $module->l('UPS'), 'LAPOSTE' => $module->l('LA POSTE'));
 }
コード例 #5
0
 /**
  * @return bool
  */
 protected function installTables()
 {
     ShopGate::log('INSTALLATION - fetching database object', ShopgateLogger::LOGTYPE_DEBUG);
     $db = Db::getInstance(true);
     if (!file_exists(dirname(__FILE__) . '/' . self::INSTALL_SQL_FILE)) {
         return false;
     } else {
         if (!($sql = version_compare(_PS_VERSION_, '1.4.0.10', '>=') ? Tools::file_get_contents(dirname(__FILE__) . '/' . self::INSTALL_SQL_FILE) : file_get_contents(dirname(__FILE__) . '/' . self::INSTALL_SQL_FILE))) {
             return false;
         }
     }
     $sql = str_replace('PREFIX_', _DB_PREFIX_, $sql);
     $sql = preg_split("/;\\s*[\r\n]+/", $sql);
     ShopGate::log('INSTALLATION - install tables', ShopgateLogger::LOGTYPE_DEBUG);
     foreach ($sql as $query) {
         if ($query) {
             if (!$db->execute(trim($query))) {
                 return false;
             }
         }
     }
     return true;
 }