Ребят такая проблема не пойму куда копать . Создал перевозчика при установке модуля .... Но его не видно при оформлении заказа в корзине . Сравнил в базе данных по полям с другими перевозчиками все одинаково . группы пользователей и страны привязаны как в остальных перевозчиков . Когда в таблице carrier ставлю is_module = 0 и external_shipping = 0 то перевозчик появляеться...
Пример кода как создаю перевозчика из модуля:
public function install()
{
// We create a table containing information on the two carriers
// that we want to create
$carrierConfig = array(
0 => array('name' => 'AKSIOMUS',
'id_tax_rules_group' => 0, // We do not apply thecarriers tax
'active' => true,
'deleted' => 0,
'shipping_handling' => false,
'range_behavior' => 0,
'delay' => array(
'en' => 'Aksiomus and company', Language::getIsoById(Configuration::get('PS_LANG_DEFAULT')) => 'Аксиомус и компании'),
'id_zone' => 7, // Area where the carrier operates
'is_module' => true, // We specify that it is a module
'shipping_external' => true,
'external_module_name' => 'AKSIOMUS', // We specify the name of the module
'need_range' => true // We specify that we want the calculations for the ranges
// that are configured in the back office
)
);
// We create the two carriers and retrieve the carrier ids
// And save the ids in a database
// Feel free to take a look at the code to see how installExternalCarrier works
// However you should not normally need to modify this function
$id_carrier = $this->installExternalCarrier($carrierConfig[0]);
Configuration::updateValue('carrieraksi_ID', (int)$id_carrier);
// Then proceed with a standard module install
// Later we will take a look at the purpose of theupdatecarrier hook
if (!parent::install() ||
!Configuration::updateValue('carrieraksi_ID', (int)$id_carrier) ||
!$this->registerHook('updateCarrier'))
return false;
return true;
}
private static function installExternalCarrier($config)
{
$carrier = new Carrier();
$carrier->name = $config['name'];
$carrier->id_tax_rules_group = $config['id_tax_rules_group'];
$carrier->id_zone = $config['id_zone'];
$carrier->active = $config['active'];
$carrier->deleted = $config['deleted'];
$carrier->delay = $config['delay'];
$carrier->shipping_handling = $config['shipping_handling'];
$carrier->range_behavior = $config['range_behavior'];
$carrier->is_module = $config['is_module'];
$carrier->shipping_external = $config['shipping_external'];
$carrier->external_module_name = $config['external_module_name'];
$carrier->need_range = $config['need_range'];
$languages = Language::getLanguages(true);
foreach ($languages as $language) {
if (!isset($config['delay'][$language['iso_code']]))
$carrier->delay[$language['id_lang']] = $config['delay']['default'];
else
$carrier->delay[(int)$language['id_lang']] = $config['delay'][$language['iso_code']];
}
if ($carrier->add()) {
$groups = Group::getGroups(true);
foreach ($groups as $group)
Db::getInstance()->autoExecute(_DB_PREFIX_ . 'carrier_group', array('id_carrier' => (int)($carrier->id), 'id_group' => (int)($group['id_group'])), 'INSERT');
$rangePrice = new RangePrice();
$rangePrice->id_carrier = $carrier->id;
$rangePrice->delimiter1 = '0';
$rangePrice->delimiter2 = '1000000';
$rangePrice->add();
$rangeWeight = new RangeWeight();
$rangeWeight->id_carrier = $carrier->id;
$rangeWeight->delimiter1 = '0';
$rangeWeight->delimiter2 = '1000000';
$rangeWeight->add();
$zones = Zone::getZones(true);
foreach ($zones as $zone) {
Db::getInstance()->autoExecute(_DB_PREFIX_ . 'carrier_zone', array('id_carrier' => (int)($carrier->id), 'id_zone' => (int)($zone['id_zone'])), 'INSERT');
Db::getInstance()->autoExecuteWithNullValues(_DB_PREFIX_ . 'delivery', array('id_carrier' => (int)($carrier->id), 'id_range_price' => (int)($rangePrice->id), 'id_range_weight' => NULL, 'id_zone' => (int)($zone['id_zone']), 'price' => '0'), 'INSERT');
Db::getInstance()->autoExecuteWithNullValues(_DB_PREFIX_ . 'delivery', array('id_carrier' => (int)($carrier->id), 'id_range_price' => NULL, 'id_range_weight' => (int)($rangeWeight->id), 'id_zone' => (int)($zone['id_zone']), 'price' => '0'), 'INSERT');
}
if (!copy(dirname(__FILE__) . '/aksiomus.jpg', _PS_SHIP_IMG_DIR_ . '/' . (int)$carrier->id . '.jpg'))
return false;
return (int)($carrier->id);
}
return false;
}