Jump to content

Help with Display Carrier Module


Recommended Posts

Good morning,

 

I created a module that adds carriers obtained through an external web service. The ADDICTION to the database is done correctly and in phpmyadmin shown carrier created.

However, the screen carriers not shown the carriers installed and print out the following line error error error: 

 

Warning: strip_tags() expects parameter 1 to be string, array given in C:\xampp\htdocs\prestashop\classes\db\Db.php on line 815

 

Deputy installation code carriers:

 

$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 = $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->delimiter1 = $envio->precioBase;
                    //$rangePrice->delimiter2 = $envio->precioBase;
                    $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');                             
                    
                }
        }
 
 
Please help me.
Edited by deustotechMobility (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...