sucemaya
Members-
Posts
19 -
Joined
-
Last visited
Profile Information
-
Activity
Other
Recent Profile Visitors
2,199,390 profile views
sucemaya's Achievements
Newbie (1/14)
1
Reputation
-
Adding custom fields for combinations - PS1.6
sucemaya replied to sucemaya's topic in Core developers
Yes!!! That's it!!! I forgot to subscribe to this thread, so I did not see this answer until now After updating products.js it is working fine, that was the step missing... Many thanks!!! And sorry for the late answer -
Hello, Same problem here. Value is stored into database, but when editing combinations, custom attribute field is not populated. Anyone can help please? EDIT: There is one more file to edit, js/admin/products.js It is answered here: https://www.prestashop.com/forums/topic/442471-adding-custom-fields-for-combinations-ps16/?do=findComment&comment=2062529
-
Wanted: Attributes that work in ranges (for Sock Shop)
sucemaya replied to stijnmenkehorst's topic in Core developers
Uhhmmm... I wonder making this to work in layerednavigation module is a complex task. I cannot see a quick way to do this without messing a lot with module files -
Wanted: Attributes that work in ranges (for Sock Shop)
sucemaya replied to stijnmenkehorst's topic in Core developers
I am not sure if I understood what you need...? You want to filter in the product page, by including a size selector somehow and then showing only combinations that suit to that size? Or do you want to include this filter elsewhere (layerednavigation, for instance)? Rafa. -
Adding custom fields for combinations - PS1.6
sucemaya replied to sucemaya's topic in Core developers
Up! Anyone can provide some help? Thanks! -
Hello, I need to add a new field to product combinations. The idea is to fill it from the backoffice, product combinations and then to show the value in product.tpl depending on the combination selected. I have made some modifications based on the information explained in this topic (info is for PS 1.5): https://www.prestashop.com/forums/topic/256683-adding-customm-field-in-combination-tab/ In my PS 1.6.0.14 installation I have managed to successfully add the field and fill it from the backoffice (this is working fine). However, I cnt manage to show the value in the corresponding text box in the backoffice. Here a description of the changes made, so maybe someone can help me (or it can also be useful for other people): New field name is "plazo_envio" First of all, I have added a new column to ps_product_attribute (and also to ps_product_attribute_shop, although I am not working in multistore mode) called "plazo_envio" and defined as a varchr(250). - Modified combinations.tpl to include a text box for the new field: <div class="form-group"> <label class="control-label col-lg-3" for="attribute_plazo_envio"> {l s='Texto plazo de envío'} </label> <div class="col-lg-5"> <input maxlength="250" type="text" id="attribute_plazo_envio" name="attribute_plazo_envio" value="" /> </div> </div> - Modified Combination.php (added new property): public $plazo_envio; 'plazo_envio' => array('type' => self::TYPE_STRING, 'size' => 250), - Modified Product.php in order to include "plazo_envio": public function addCombinationEntity($wholesale_price, $price, $weight, $unit_impact, $ecotax, $quantity, $id_images, $reference, $plazo_envio, $id_supplier, $ean13, $default, $location = null, $upc = null, $minimal_quantity = 1, array $id_shop_list = array(), $available_date = null) { $id_product_attribute = $this->addAttribute( $price, $weight, $unit_impact, $ecotax, $id_images, $reference, $plazo_envio, $ean13, $default, $location, $upc, $minimal_quantity, $id_shop_list, $available_date); $this->addSupplierReference($id_supplier, $id_product_attribute); $result = ObjectModel::updateMultishopTable('Combination', array( 'wholesale_price' => (float)$wholesale_price, ), 'a.id_product_attribute = '.(int)$id_product_attribute); if (!$id_product_attribute || !$result) return false; return $id_product_attribute; } public function updateAttribute($id_product_attribute, $wholesale_price, $price, $weight, $unit, $ecotax, $id_images, $reference, $plazo_envio, $ean13, $default, $location = null, $upc = null, $minimal_quantity = null, $available_date = null, $update_all_fields = true, array $id_shop_list = array()) { $combination = new Combination($id_product_attribute); if (!$update_all_fields) $combination->setFieldsToUpdate(array( 'price' => !is_null($price), 'wholesale_price' => !is_null($wholesale_price), 'ecotax' => !is_null($ecotax), 'weight' => !is_null($weight), 'unit_price_impact' => !is_null($unit), 'default_on' => !is_null($default), 'minimal_quantity' => !is_null($minimal_quantity), 'available_date' => !is_null($available_date), )); $price = str_replace(',', '.', $price); $weight = str_replace(',', '.', $weight); $combination->price = (float)$price; $combination->wholesale_price = (float)$wholesale_price; $combination->ecotax = (float)$ecotax; $combination->weight = (float)$weight; $combination->unit_price_impact = (float)$unit; $combination->reference = pSQL($reference); $combination->plazo_envio = pSQL($plazo_envio); $combination->location = pSQL($location); $combination->ean13 = pSQL($ean13); $combination->upc = pSQL($upc); $combination->default_on = (int)$default; $combination->minimal_quantity = (int)$minimal_quantity; $combination->available_date = $available_date ? pSQL($available_date) : '0000-00-00'; if (count($id_shop_list)) $combination->id_shop_list = $id_shop_list; $combination->save(); if (is_array($id_images) && count($id_images)) $combination->setImages($id_images); $id_default_attribute = (int)Product::updateDefaultAttribute($this->id); if ($id_default_attribute) $this->cache_default_attribute = $id_default_attribute; Hook::exec('actionProductAttributeUpdate', array('id_product_attribute' => (int)$id_product_attribute)); Tools::clearColorListCache($this->id); return true; } public function addAttribute($price, $weight, $unit_impact, $ecotax, $id_images, $reference, $plazo_envio, $ean13, $default, $location = null, $upc = null, $minimal_quantity = 1, array $id_shop_list = array(), $available_date = null) { if (!$this->id) return; $price = str_replace(',', '.', $price); $weight = str_replace(',', '.', $weight); $combination = new Combination(); $combination->id_product = (int)$this->id; $combination->price = (float)$price; $combination->ecotax = (float)$ecotax; $combination->quantity = 0; $combination->weight = (float)$weight; $combination->unit_price_impact = (float)$unit_impact; $combination->reference = pSQL($reference); $combination->plazo_envio = pSQL($plazo_envio); $combination->location = pSQL($location); $combination->ean13 = pSQL($ean13); $combination->upc = pSQL($upc); $combination->default_on = (int)$default; $combination->minimal_quantity = (int)$minimal_quantity; $combination->available_date = $available_date; if (count($id_shop_list)) $combination->id_shop_list = array_unique($id_shop_list); $combination->add(); if (!$combination->id) return false; $total_quantity = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(' SELECT SUM(quantity) as quantity FROM '._DB_PREFIX_.'stock_available WHERE id_product = '.(int)$this->id.' AND id_product_attribute <> 0 ' ); if (!$total_quantity) Db::getInstance()->update('stock_available', array('quantity' => 0), '`id_product` = '.$this->id); $id_default_attribute = Product::updateDefaultAttribute($this->id); if ($id_default_attribute) { $this->cache_default_attribute = $id_default_attribute; if (!$combination->available_date) $this->setAvailableDate(); } if (!empty($id_images)) $combination->setImages($id_images); Tools::clearColorListCache($this->id); if (Configuration::get('PS_DEFAULT_WAREHOUSE_NEW_PRODUCT') != 0 && Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) { $warehouse_location_entity = new WarehouseProductLocation(); $warehouse_location_entity->id_product = $this->id; $warehouse_location_entity->id_product_attribute = (int)$combination->id; $warehouse_location_entity->id_warehouse = Configuration::get('PS_DEFAULT_WAREHOUSE_NEW_PRODUCT'); $warehouse_location_entity->location = pSQL(''); $warehouse_location_entity->save(); } return (int)$combination->id; } public function getAttributesGroups($id_lang) { if (!Combination::isFeatureActive()) return array(); $sql = 'SELECT ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, agl.`public_name` AS public_group_name, a.`id_attribute`, al.`name` AS attribute_name, a.`color` AS attribute_color, product_attribute_shop.`id_product_attribute`, IFNULL(stock.quantity, 0) as quantity, product_attribute_shop.`price`, product_attribute_shop.`ecotax`, product_attribute_shop.`weight`, product_attribute_shop.`default_on`, pa.`reference`, pa.`plazo_envio`, product_attribute_shop.`unit_price_impact`, product_attribute_shop.`minimal_quantity`, product_attribute_shop.`available_date`, ag.`group_type` FROM `'._DB_PREFIX_.'product_attribute` pa '.Shop::addSqlAssociation('product_attribute', 'pa').' '.Product::sqlStock('pa', 'pa').' LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.`id_product_attribute` = pa.`id_product_attribute`) LEFT JOIN `'._DB_PREFIX_.'attribute` a ON (a.`id_attribute` = pac.`id_attribute`) LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON (ag.`id_attribute_group` = a.`id_attribute_group`) LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute`) LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group`) '.Shop::addSqlAssociation('attribute', 'a').' WHERE pa.`id_product` = '.(int)$this->id.' AND al.`id_lang` = '.(int)$id_lang.' AND agl.`id_lang` = '.(int)$id_lang.' GROUP BY id_attribute_group, id_product_attribute ORDER BY ag.`position` ASC, a.`position` ASC, agl.`name` ASC'; return Db::getInstance()->executeS($sql); } Modified ProductsController.php: function assignAttributesGroups: $combinations[$row['id_product_attribute']]['plazo_envio'] = $row['plazo_envio']; Finally, I have included "plazo_envio" in AdminProductsController.php: Funtion processProductAttribute: Tools::getValue('attribute_plazo_envio'), Tools::getValue('attribute_plazo_envio'), Function initFormInformations: array_push($product_props, 'reference', 'plazo_envio', 'ean13', 'upc', 'available_for_order', 'show_price', 'online_only', 'id_manufacturer' ); Function renderListAttributes: $comb_array[$combination['id_product_attribute']]['plazo_envio'] = $combination['plazo_envio']; The result is that I can successfully add the info to the data base (the text box shows when I edit a combination, and I can fill it the text box, press save and the the info is saved in column "plazo_envio" in table ps_product_attribute BUT on page load I the text box is empty in the backoffice, so I cannot see the info in "plazo_envio" column). I hope someone can help me to accomplish this task, it seems I am very close to manage it. Thanks in advance for your help
-
Hello! This worked for me: Go to modules directory. Change directory permissions to 755 and apply it recursively for foders and files. You can do this through FTP, if you use Filezilla just right click on paypal folder, select "file permissions", set numeric value to 755 and check include subfolders and apply to files and folders. You can also do this logging in your sever with ssh, go to modules folder and run: chmod -R 755 paypal After re-setting permissions to 755, my store is working fine again with updated 3.8.1 version of Paypal module (Spain) Good luck!
-
Uhmmm... es posible que alguna regla del .htaccess esté impidiendo el acceso a este fichero. Llegados a este punto, y para ir ganando tiempo, yo iría poniendo un ticket al hosting para preguntarles cual es el memory_limit del php.ini y pedirles si te lo pueden ampliar mientras pensamos otra cosa. Has incluido los cambios primero que te ha comentado rafaelamargo en el fichero config.inc.php y sigues teniendo la página en blanco? Si es así puede que sea o bien porque no es un problema de memoria o bien porque hay una limitación del hosting y lo que pongas ahí no sirve para nada (voto por esto segundo)
-
Prueba antes a borrar la carpeta paypal de la carpeta de módulos tanto dentro de modules como en themes/tu_tema/modules. Así por lo menos vemos si es algo que afecta sólo al módulo de Paypal. Traqui, que estamos para echar una mano. Yo me pongo supernervioso cuando se me cae una tienda y se agradece que haya gente intentando aportar
-
Zoser, puedes poner una captura de cómo te aparece la página? Cuando dices en blanco quieres decir "blanco, blanco", es decir, como si no hubiera terminado de cargar, o es más bien que carga normal pero es como si no existiera ningún módulo? Por otra parte, cosas que se me ocurren: - Accede a través de FTP a tu host y borra la carpeta del módulo paypal de la carpeta modules (puedes hacer una copia primero). - Tienes acceso de root a tu hosting? No estaría de más probar también a darle más memoria a los procesos PHP como te comentaba al principio. Tengo aún alguna tienda en PResta 1.4 y la carga de la página de los módulos consume muchísimo. Ya nos vas contando. Saludos!