Example #1
0
 public function prepareData($shipping_info)
 {
     $this->_shipping_info = $shipping_info;
     $module = fn_camelize($shipping_info['service_code']);
     if ($module == 'RussianPost') {
         $module = 'RussianPostOfficial';
     }
     $module = 'Tygh\\Shippings\\Services\\' . $module;
     if (class_exists($module)) {
         $module_obj = new $module();
         $module_obj->prepareData($shipping_info);
         $this->_module = $module_obj;
     }
 }
Example #2
0
 /**
  * Adds shipping service data to stack for future calculations
  *
  * @param  int   $shipping_key  Shipping service array position
  * @param  array $shipping_info Shipping service data
  * @return bool  true if information was added to stack, false otherwise
  */
 public static function register($shipping_key, $shipping_info)
 {
     if (empty($shipping_info['service_params'])) {
         return self::_processErrorCode(self::SERVICE_NOT_CONFIGURED);
     }
     $module = fn_camelize($shipping_info['module']);
     $module = 'Tygh\\Shippings\\Services\\' . $module;
     if (class_exists($module)) {
         $module_obj = new $module();
         $module_obj->prepareData($shipping_info);
         self::$_services_stack[$shipping_key] = $module_obj;
     } else {
         return self::_processErrorCode(self::SERVICE_NOT_FOUND);
     }
     return self::_processErrorCode(self::SERVICE_NOT_ERROR);
 }
Example #3
0
 public function getOffer($product)
 {
     if (!empty($product['yml2_offer_type'])) {
         $offer_type = $product['yml2_offer_type'];
     } elseif (!empty($this->options['offer_type_categories'][$product['category_id']])) {
         $offer_type = $this->options['offer_type_categories'][$product['category_id']];
     } else {
         $offer_type = 'simple';
     }
     if (!isset($this->offers[$offer_type])) {
         $offer_class = "\\Tygh\\Ym\\Offers\\" . fn_camelize($offer_type);
         if (class_exists($offer_class)) {
             $offer = $this->offers[$offer_type] = new $offer_class($this->options, $this->log);
         } else {
             throw new \Exception("The wrong offer");
         }
     } else {
         $offer = $this->offers[$offer_type];
     }
     return $offer;
 }
Example #4
0
     $offers_features = array();
     foreach ($offer_common_features_list as $offer_feature_key => $offer_feature_name) {
         if (is_array($offer_feature_name)) {
             $offers_features[$offer_feature_key] = array();
             if (!empty($offers_features_values[$offer_feature_key])) {
                 $offers_features[$offer_feature_key] = $offers_features_values[$offer_feature_key];
             }
             $offers_features[$offer_feature_key] = array_merge($offers_features[$offer_feature_key], $offer_feature_name);
         } elseif (!empty($offers_features_values[$offer_feature_name])) {
             $offers_features[$offer_feature_name] = $offers_features_values[$offer_feature_name];
         } else {
             $offers_features[$offer_feature_name] = array();
         }
     }
 } else {
     $offer_class = "\\Tygh\\Ym\\Offers\\" . fn_camelize($offer);
     if (class_exists($offer_class)) {
         $offer = new $offer_class();
     }
     $offer_features_list = $offer->getFeatures();
     foreach ($offer_features_list as $offer_feature_name) {
         if (!empty($offers_features_values[$offer_feature_name])) {
             $offers_features[$offer_feature_name] = $offers_features_values[$offer_feature_name];
         } else {
             $offers_features[$offer_feature_name] = array();
         }
     }
 }
 $objects = array();
 $objects[] = array('id' => 'empty', 'text' => __('empty'));
 if ($page_number == 1) {
Example #5
0
 * and use this program.                                                    *
 *                                                                          *
 ****************************************************************************
 * PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
 * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
 ****************************************************************************/
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    return array(CONTROLLER_STATUS_OK);
}
if ($mode == 'update' || $mode == 'add') {
    Registry::set('navigation.tabs.yml', array('title' => __('yml_export'), 'js' => true));
    $offer_class = "\\Tygh\\Ym\\Offers\\" . fn_camelize('base');
    if (class_exists($offer_class)) {
        $offer = new $offer_class();
    } else {
        throw new \Exception("The wrong offer class");
    }
    $category_data = Tygh::$app['view']->getTemplateVars('category_data');
    $offer_common_features_list = $offer->getCommonFeatures();
    $offers_features = array();
    foreach ($offer_common_features_list as $offer_feature_key => $offer_feature_name) {
        if (!in_array($offer_feature_key, array('model', 'typePrefix'))) {
            continue;
        }
        if (is_array($offer_feature_name)) {
            $offers_features['common'][$offer_feature_key] = array();
            if (!empty($category_data['yml2_' . fn_uncamelize($offer_feature_key) . '_select'])) {
Example #6
0
 /**
  * Gets list of the available Upgrade Connectors
  *
  * @return array List of connector objects
  */
 protected function getConnectors()
 {
     if (empty($this->connectors)) {
         $connector = new Connectors\Core\Connector();
         $this->connectors['core'] = $connector;
         // Extend connectors by addons
         $addons = Registry::get('addons');
         foreach ($addons as $addon_name => $settings) {
             $class_name = "\\Tygh\\UpgradeCenter\\Connectors\\" . fn_camelize($addon_name) . "\\Connector";
             $connector = class_exists($class_name) ? new $class_name() : null;
             if (!is_null($connector)) {
                 $this->connectors[$addon_name] = $connector;
             }
         }
     }
     return $this->connectors;
 }
Example #7
0
<?php

/***************************************************************************
*                                                                          *
*   (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev    *
*                                                                          *
* This  is  commercial  software,  only  users  who have purchased a valid *
* license  and  accept  to the terms of the  License Agreement can install *
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
if ($mode == 'generate') {
    fn_disable_live_editor_mode();
    $schema = fn_get_schema('price_list', 'schema');
    if (empty($_REQUEST['display']) || empty($schema['types'][$_REQUEST['display']])) {
        return array(CONTROLLER_STATUS_DENIED);
    }
    $class_name = '\\Tygh\\PriceList\\' . fn_camelize($_REQUEST['display']);
    if (class_exists($class_name)) {
        $generator = new $class_name();
        $generator->generate(true);
    }
    exit;
}
Example #8
0
 /**
  * Returns instance of Entity class by entity properties
  *
  * @param  array             $entity_properties Entity properties data @see Api::getEntityFromPath
  * @return \Tygh\Api\AEntity
  */
 private function getObjectByEntity($entity_properties)
 {
     $version = $this->called_version == self::CURRENT_VERSION ? '' : 'v' . str_replace('.', '', $this->called_version) . '\\';
     $class_name = "\\Tygh\\Api\\Entities\\" . $version . fn_camelize($entity_properties['name']);
     $entity = class_exists($class_name) ? new $class_name($this->auth, $this->area) : null;
     if (!$entity) {
         $class_name = "\\Tygh\\Api\\Entities\\" . fn_camelize($entity_properties['name']);
         if (class_exists($class_name)) {
             $entity = new $class_name($this->auth);
         }
     }
     return $entity;
 }
Example #9
0
 /**
  * Returns instance of Entity class by entity properties
  *
  * @param  array             $entity_properties Entity properties data @see Api::getEntityFromPath
  * @return \Tygh\Api\AEntity
  */
 protected function getObjectByEntity($entity_properties)
 {
     $version_namespace = '';
     $_called_version = str_replace('.', '', $this->called_version);
     $_current_version = str_replace('.', '', self::CURRENT_VERSION);
     if ($_called_version != $_current_version) {
         $version_namespace = 'v' . $_called_version . '\\';
     }
     $class_name = "\\Tygh\\Api\\Entities\\" . $version_namespace . fn_camelize($entity_properties['name']);
     $entity = class_exists($class_name) ? new $class_name($this->auth, $this->area) : null;
     return $entity;
 }