deustotechMobility Posted June 12, 2016 Share Posted June 12, 2016 Buenos días, he creado un módulo que añade transportistas en prestashop obtenidos a traves de una API externo a partir de una serie de parámetros estipulados. La addición de dichos métodos de transporte a la base de datos de prestashop se realiza de forma adecuada, sin embargo a la hora de mostrar los transportes en el paso 4: Transporte sale el siguiente error: Warning: strip_tags() expects parameter 1 to be string, array given in C:\xampp\htdocs\prestashop\classes\db\Db.php on line 815 El método de instalación de transportes es el siguiente: public function installCarriers() { $id_lang_default = Language::getIsoById(Configuration::get('PS_LANG_DEFAULT')); $envios = Configuration::get('ENVIOS'); foreach ($envios as $env) { $carrier = new Carrier(); $carrier->name = $env->nombreModo; $carrier->id_tax_rules_group = 0; $carrier->active = TRUE; $carrier->deleted = 0; foreach (Language::getLanguages(true) as $language) $carrier->delay[(int)$language['id_lang']] = $env->periodo_dia; $carrier->shipping_handling = false; $carrier->range_behavior = 0; $carrier->is_module = true; $carrier->is_free = false; $carrier->shipping_external = false; $carrier->external_module_name = (string)$this->name; $carrier->need_range = true; if ($carrier->add()) { // Associate carrier to all groups $groups = Group::getGroups(true); foreach ($groups as $group) Db::getInstance()->insert('carrier_group', array('id_carrier' => (int)$carrier->id, 'id_group' => (int)$group['id_group'])); // Create price range $aux1 = intval($env->precioBase); $aux2 = $aux1+1; $rangePrice = new RangePrice(); $rangePrice->id_carrier = $carrier->id; $rangePrice->delimiter1 = $aux1; $rangePrice->delimiter2 = $aux2; $rangePrice->add(); // Crear el rango de pesos para el carrier $rangeWeight = new RangeWeight(); $rangeWeight->id_carrier = $carrier->id; $rangeWeight->delimiter1 = '0'; $rangeWeight->delimiter2 = '10000'; $rangeWeight->add(); //Calculo del precio incluyendo el IVA (21%) $priceIVA = str_replace(',', '.', $env->precioBase); $priceIVA = (float)$priceIVA + (float)$priceIVA*(float)0.21; // Asociar el carrier a la zona 1 = Europa $zone = Zone::getIdByName('Europe'); Db::getInstance()->insert('carrier_zone', array('id_carrier' => (int)$carrier->id, 'id_zone' => (int)$zone)); Db::getInstance()->insert('delivery', array('id_carrier' => (int)$carrier->id, 'id_range_price' => (int)$rangePrice->id, 'id_range_weight' => (int)$rangeWeight->id, 'id_zone' => (int)$zone, 'price' => $priceIVA)); // Copy the carrier logo copy(dirname(__FILE__).'/views/img/'.$env->urlEmpresa, _PS_SHIP_IMG_DIR_.'/'.(int)$carrier->id.'.jpg'); } } } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now