Jump to content

guil182

Members
  • Posts

    120
  • Joined

  • Last visited

About guil182

  • Birthday 02/14/1980

Profile Information

  • Location
    Bordeaux

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

guil182's Achievements

  1. hi, I want to stop ProductSpin with max = $product.quantity. So, I modify product-add-to-cart.tpl : <input type="number" name="qty" id="quantity_wanted" value="{$product.quantity_wanted}"  class="input-group" min="{$product.minimal_quantity}" max="{$product.quantity}" step="{$product.minimal_quantity}" > et j'ai surchargé product.js en créant un product.js dans un theme enfant. And I create a product.js in a child theme $(document).ready(function () { createProductSpin(); prestashop.on('updatedProduct', function (event) { if (event && event.product_minimal_quantity) { const minimalProductQuantity = parseInt(event.product_minimal_quantity, 10); const quantityInputSelector = '#quantity_wanted'; let quantityInput = $(quantityInputSelector); let quantityMax = parseInt($('#pmax').text()); // @see http://www.virtuosoft.eu/code/bootstrap-touchspin/ about Bootstrap TouchSpin quantityInput.trigger('touchspin.updatesettings', {min: minimalProductQuantity,step: minimalProductQuantity,max: quantityMax}); } }); function createProductSpin() { const $quantityInput = $('#quantity_wanted'); $quantityInput.TouchSpin({ verticalbuttons: true, verticalupclass: 'material-icons touchspin-up', verticaldownclass: 'material-icons touchspin-down', buttondown_class: 'btn btn-touchspin js-touchspin', buttonup_class: 'btn btn-touchspin js-touchspin', min: parseInt($quantityInput.attr('min'), 10), max: parseInt($quantityInput.attr('max'), 10), step: parseInt($quantityInput.attr('step'), 10) }); $('body').on('change keyup', '#quantity_wanted', (e) => { $(e.currentTarget).trigger('touchspin.stopspin'); prestashop.emit('updateProduct', { eventType: 'updatedProductQuantity', event: e }); }); } }); I work...almost ! Indeed, when we arrive on the page, we can quickly press the "up", the quantity is not blocked .... it is blocked after the Ajax response of updated cart 😕 The result : http://prestashop.lenclosdesvins.com/pomerol/20-chateau-la-conseillante-2010.html Thank for your help
  2. Merci Eolia, Mais justement ce n'est pas fait avec product-add-to-cart.tpl et la fonction createProductSpin() ? Sinon comment faut il faire ?
  3. Bonjour, j'essaye de bloquer ProductSpin avec max = $product.quantity. Pour cela, j'ai modifier product-add-to-cart.tpl <input type="number" name="qty" id="quantity_wanted" value="{$product.quantity_wanted}" class="input-group" min="{$product.minimal_quantity}" max="{$product.quantity}" step="{$product.minimal_quantity}" > et j'ai surchargé product.js en créant un product.js dans un theme enfant. $(document).ready(function () { createProductSpin(); prestashop.on('updatedProduct', function (event) { if (event && event.product_minimal_quantity) { const minimalProductQuantity = parseInt(event.product_minimal_quantity, 10); const quantityInputSelector = '#quantity_wanted'; let quantityInput = $(quantityInputSelector); let quantityMax = parseInt($('#pmax').text()); // @see http://www.virtuosoft.eu/code/bootstrap-touchspin/ about Bootstrap TouchSpin quantityInput.trigger('touchspin.updatesettings', {min: minimalProductQuantity,step: minimalProductQuantity,max: quantityMax}); } }); function createProductSpin() { const $quantityInput = $('#quantity_wanted'); $quantityInput.TouchSpin({ verticalbuttons: true, verticalupclass: 'material-icons touchspin-up', verticaldownclass: 'material-icons touchspin-down', buttondown_class: 'btn btn-touchspin js-touchspin', buttonup_class: 'btn btn-touchspin js-touchspin', min: parseInt($quantityInput.attr('min'), 10), max: parseInt($quantityInput.attr('max'), 10), step: parseInt($quantityInput.attr('step'), 10) }); $('body').on('change keyup', '#quantity_wanted', (e) => { $(e.currentTarget).trigger('touchspin.stopspin'); prestashop.emit('updateProduct', { eventType: 'updatedProductQuantity', event: e }); }); } }); Ca marche...presque ! En effet, lorsque qu'on arrive sur la page, on peut appuyer très vite sur le "up", la quantité n'est pas bloquée....elle ne se bloque qu'après la réponse Ajax de updated cart 😕 Le résultat : http://prestashop.lenclosdesvins.com/pomerol/20-chateau-la-conseillante-2010.html Merci d'avance de votre aide
  4. Bonjour, Je souhaite ajouter un champ date pour les catégories dans le backend. Il existe des tutos pour les versions 1.7...mais force est de constater que pour la version 1.7.6, l'architecture à été modifiée. Aussi, apparemment je dois travailler à partir de hookDisplayBackOfficeCategory($params) mais après je ne peux vous mettre quoi que ce soit en code car tous mes essais ont été infructueux 😕 En espérant votre aide. Merci d'avance
  5. Messieurs, Effectivement, j'ai des erreurs de syntaxe, désolé. Par contre, même en mode début, rien en sortie comme message d'erreur...:/
  6. Bonjour, J'essaye d'excuser un script (un futur cron). Pour cela, j'ai fait un script dans monmodule/script.php. Or, quand j'essaye d'executer http://www.monsite.com/modules/monmodule/script.php rien ne se passe ? problème de htaccess ou autre ? Merci de votre aide
  7. Je pense avoir trouvé... get_class($this->context->controller); Cela renvoie dans ce cas: AdminProductsController
  8. Sauf que je ne vois rien relatif au controller dans $params Array ( [id_product] => 23 [product] => Product Object ( [tax_name] => [tax_rate] => [id_manufacturer] => 3 [id_supplier] => 0 [id_category_default] => 13 [id_shop_default] => 1 [manufacturer_name] => [supplier_name] => [name] => Array ( [1] => Château PICHON-LONGUEVILLE BARON 2007 ) [description] => Array ( [1] => ) [description_short] => Array ( [1] => <p>Racheté en 1986 par le groupe AXA, placé dans un premier temps sous la conduite de M. Cazes (Lynch-Bages), <strong>Pichon-Longueville Baron</strong> retrouve sa meilleure forme dans le style puissant et racé des grands Pauillac. Il faut dire qu’une petite moitié de ses vignes jouxte celles de Latour, sur un terroir de premier cru ! Pour la Revue du Vin de France : « <em>Pichon-Baron est au sommet dans les derniers millésimes</em> ».</p> ) [quantity] => 0 [minimal_quantity] => 1 [low_stock_threshold] => [low_stock_alert] => [available_now] => Array ( [1] => ) [available_later] => Array ( [1] => ) [price] => 0 [specificPrice] => 0 [additional_shipping_cost] => 0 [wholesale_price] => 0 [on_sale] => [online_only] => [unity] => [unit_price] => 0 [unit_price_ratio] => 0.000000 [ecotax] => 0 [reference] => [supplier_reference] => [location] => [width] => 0 [height] => 0 [depth] => 0 [weight] => 0 [ean13] => [isbn] => [upc] => [link_rewrite] => Array ( [1] => chateau-pichon-longueville-baron-2016 ) [meta_description] => Array ( [1] => ) [meta_keywords] => Array ( [1] => ) [meta_title] => Array ( [1] => ) [quantity_discount] => 0 [customizable] => 0 [new] => [uploadable_files] => 0 [text_fields] => 0 [active] => 1 [redirect_type] => 301-category [id_type_redirected] => 0 [available_for_order] => 1 [available_date] => [show_condition] => [condition] => new [show_price] => 1 [indexed] => 0 [visibility] => both [date_add] => 2019-03-26 10:36:52 [date_upd] => 2019-04-10 11:49:55 [tags] => [state] => 1 [base_price] => [id_tax_rules_group] => 1 [id_color_default] => 0 [advanced_stock_management] => [out_of_stock] => 2 [depends_on_stock] => [isFullyLoaded] => [cache_is_pack] => 0 [cache_has_attachments] => 0 [is_virtual] => 0 [id_pack_product_attribute] => [cache_default_attribute] => 43 [category] => [pack_stock_type] => 3 [additional_delivery_times] => 1 [delivery_in_stock] => Array ( [1] => ) [delivery_out_stock] => Array ( [1] => ) [webserviceParameters:protected] => Array ( [objectMethods] => Array ( [add] => addWs [update] => updateWs ) [objectNodeNames] => products [fields] => Array ( [id_manufacturer] => Array ( [xlink_resource] => manufacturers ) [id_supplier] => Array ( [xlink_resource] => suppliers ) [id_category_default] => Array ( [xlink_resource] => categories ) [new] => Array ( ) [cache_default_attribute] => Array ( ) [id_default_image] => Array ( [getter] => getCoverWs [setter] => setCoverWs [xlink_resource] => Array ( [resourceName] => images [subResourceName] => products ) ) [id_default_combination] => Array ( [getter] => getWsDefaultCombination [setter] => setWsDefaultCombination [xlink_resource] => Array ( [resourceName] => combinations ) ) [id_tax_rules_group] => Array ( [xlink_resource] => Array ( [resourceName] => tax_rule_groups ) ) [position_in_category] => Array ( [getter] => getWsPositionInCategory [setter] => setWsPositionInCategory ) [manufacturer_name] => Array ( [getter] => getWsManufacturerName [setter] => ) [quantity] => Array ( [getter] => [setter] => ) [type] => Array ( [getter] => getWsType [setter] => setWsType ) ) [associations] => Array ( [categories] => Array ( [resource] => category [fields] => Array ( [id] => Array ( [required] => 1 ) ) ) [images] => Array ( [resource] => image [fields] => Array ( [id] => Array ( ) ) ) [combinations] => Array ( [resource] => combination [fields] => Array ( [id] => Array ( [required] => 1 ) ) ) [product_option_values] => Array ( [resource] => product_option_value [fields] => Array ( [id] => Array ( [required] => 1 ) ) ) [product_features] => Array ( [resource] => product_feature [fields] => Array ( [id] => Array ( [required] => 1 ) [id_feature_value] => Array ( [required] => 1 [xlink_resource] => product_feature_values ) ) ) [tags] => Array ( [resource] => tag [fields] => Array ( [id] => Array ( [required] => 1 ) ) ) [stock_availables] => Array ( [resource] => stock_available [fields] => Array ( [id] => Array ( [required] => 1 ) [id_product_attribute] => Array ( [required] => 1 ) ) [setter] => ) [accessories] => Array ( [resource] => product [api] => products [fields] => Array ( [id] => Array ( [required] => 1 [xlink_resource] => product ) ) ) [product_bundle] => Array ( [resource] => product [api] => products [fields] => Array ( [id] => Array ( [required] => 1 ) [quantity] => Array ( ) ) ) ) ) [id] => 23 [id_lang:protected] => [id_shop:protected] => 1 [id_shop_list] => Array ( ) [get_shop_from_context:protected] => 1 [table:protected] => product [identifier:protected] => id_product [fieldsRequired:protected] => Array ( [0] => price ) [fieldsSize:protected] => Array ( [reference] => 64 [supplier_reference] => 64 [location] => 64 [ean13] => 13 [isbn] => 32 [upc] => 12 ) [fieldsValidate:protected] => Array ( [id_shop_default] => isUnsignedId [id_manufacturer] => isUnsignedId [id_supplier] => isUnsignedId [reference] => isReference [supplier_reference] => isReference [location] => isReference [width] => isUnsignedFloat [height] => isUnsignedFloat [depth] => isUnsignedFloat [weight] => isUnsignedFloat [quantity_discount] => isBool [ean13] => isEan13 [isbn] => isIsbn [upc] => isUpc [cache_is_pack] => isBool [cache_has_attachments] => isBool [is_virtual] => isBool [state] => isUnsignedId [additional_delivery_times] => isUnsignedId [id_category_default] => isUnsignedId [id_tax_rules_group] => isUnsignedId [on_sale] => isBool [online_only] => isBool [ecotax] => isPrice [minimal_quantity] => isUnsignedInt [low_stock_threshold] => isInt [low_stock_alert] => isBool [price] => isPrice [wholesale_price] => isPrice [unity] => isString [additional_shipping_cost] => isPrice [customizable] => isUnsignedInt [text_fields] => isUnsignedInt [uploadable_files] => isUnsignedInt [active] => isBool [redirect_type] => isString [id_type_redirected] => isUnsignedId [available_for_order] => isBool [available_date] => isDateFormat [show_condition] => isBool [condition] => isGenericName [show_price] => isBool [indexed] => isBool [visibility] => isProductVisibility [advanced_stock_management] => isBool [date_add] => isDate [date_upd] => isDate [pack_stock_type] => isUnsignedInt ) [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( [delivery_in_stock] => 255 [delivery_out_stock] => 255 [meta_description] => 512 [meta_keywords] => 255 [meta_title] => 255 [link_rewrite] => 128 [name] => 128 [available_now] => 255 [available_later] => 255 ) [fieldsValidateLang:protected] => Array ( [delivery_in_stock] => isGenericName [delivery_out_stock] => isGenericName [meta_description] => isGenericName [meta_keywords] => isGenericName [meta_title] => isGenericName [link_rewrite] => isLinkRewrite [name] => isCatalogName [description] => isCleanHtml [description_short] => isCleanHtml [available_now] => isGenericName [available_later] => IsGenericName ) [tables:protected] => Array ( ) [image_dir:protected] => [image_format:protected] => jpg [translator:protected] => [def:protected] => Array ( [table] => product [primary] => id_product [multilang] => 1 [multilang_shop] => 1 [fields] => Array ( [id_shop_default] => Array ( [type] => 1 [validate] => isUnsignedId ) [id_manufacturer] => Array ( [type] => 1 [validate] => isUnsignedId ) [id_supplier] => Array ( [type] => 1 [validate] => isUnsignedId ) [reference] => Array ( [type] => 3 [validate] => isReference [size] => 64 ) [supplier_reference] => Array ( [type] => 3 [validate] => isReference [size] => 64 ) [location] => Array ( [type] => 3 [validate] => isReference [size] => 64 ) [width] => Array ( [type] => 4 [validate] => isUnsignedFloat ) [height] => Array ( [type] => 4 [validate] => isUnsignedFloat ) [depth] => Array ( [type] => 4 [validate] => isUnsignedFloat ) [weight] => Array ( [type] => 4 [validate] => isUnsignedFloat ) [quantity_discount] => Array ( [type] => 2 [validate] => isBool ) [ean13] => Array ( [type] => 3 [validate] => isEan13 [size] => 13 ) [isbn] => Array ( [type] => 3 [validate] => isIsbn [size] => 32 ) [upc] => Array ( [type] => 3 [validate] => isUpc [size] => 12 ) [cache_is_pack] => Array ( [type] => 2 [validate] => isBool ) [cache_has_attachments] => Array ( [type] => 2 [validate] => isBool ) [is_virtual] => Array ( [type] => 2 [validate] => isBool ) [state] => Array ( [type] => 1 [validate] => isUnsignedId ) [additional_delivery_times] => Array ( [type] => 1 [validate] => isUnsignedId ) [delivery_in_stock] => Array ( [type] => 3 [lang] => 1 [validate] => isGenericName [size] => 255 ) [delivery_out_stock] => Array ( [type] => 3 [lang] => 1 [validate] => isGenericName [size] => 255 ) [id_category_default] => Array ( [type] => 1 [shop] => 1 [validate] => isUnsignedId ) [id_tax_rules_group] => Array ( [type] => 1 [shop] => 1 [validate] => isUnsignedId ) [on_sale] => Array ( [type] => 2 [shop] => 1 [validate] => isBool ) [online_only] => Array ( [type] => 2 [shop] => 1 [validate] => isBool ) [ecotax] => Array ( [type] => 4 [shop] => 1 [validate] => isPrice ) [minimal_quantity] => Array ( [type] => 1 [shop] => 1 [validate] => isUnsignedInt ) [low_stock_threshold] => Array ( [type] => 1 [shop] => 1 [allow_null] => 1 [validate] => isInt ) [low_stock_alert] => Array ( [type] => 2 [shop] => 1 [allow_null] => 1 [validate] => isBool ) [price] => Array ( [type] => 4 [shop] => 1 [validate] => isPrice [required] => 1 ) [wholesale_price] => Array ( [type] => 4 [shop] => 1 [validate] => isPrice ) [unity] => Array ( [type] => 3 [shop] => 1 [validate] => isString ) [unit_price_ratio] => Array ( [type] => 4 [shop] => 1 ) [additional_shipping_cost] => Array ( [type] => 4 [shop] => 1 [validate] => isPrice ) [customizable] => Array ( [type] => 1 [shop] => 1 [validate] => isUnsignedInt ) [text_fields] => Array ( [type] => 1 [shop] => 1 [validate] => isUnsignedInt ) [uploadable_files] => Array ( [type] => 1 [shop] => 1 [validate] => isUnsignedInt ) [active] => Array ( [type] => 2 [shop] => 1 [validate] => isBool ) [redirect_type] => Array ( [type] => 3 [shop] => 1 [validate] => isString ) [id_type_redirected] => Array ( [type] => 1 [shop] => 1 [validate] => isUnsignedId ) [available_for_order] => Array ( [type] => 2 [shop] => 1 [validate] => isBool ) [available_date] => Array ( [type] => 5 [shop] => 1 [validate] => isDateFormat ) [show_condition] => Array ( [type] => 2 [shop] => 1 [validate] => isBool ) [condition] => Array ( [type] => 3 [shop] => 1 [validate] => isGenericName [values] => Array ( [0] => new [1] => used [2] => refurbished ) [default] => new ) [show_price] => Array ( [type] => 2 [shop] => 1 [validate] => isBool ) [indexed] => Array ( [type] => 2 [shop] => 1 [validate] => isBool ) [visibility] => Array ( [type] => 3 [shop] => 1 [validate] => isProductVisibility [values] => Array ( [0] => both [1] => catalog [2] => search [3] => none ) [default] => both ) [cache_default_attribute] => Array ( [type] => 1 [shop] => 1 ) [advanced_stock_management] => Array ( [type] => 2 [shop] => 1 [validate] => isBool ) [date_add] => Array ( [type] => 5 [shop] => 1 [validate] => isDate ) [date_upd] => Array ( [type] => 5 [shop] => 1 [validate] => isDate ) [pack_stock_type] => Array ( [type] => 1 [shop] => 1 [validate] => isUnsignedInt ) [meta_description] => Array ( [type] => 3 [lang] => 1 [validate] => isGenericName [size] => 512 ) [meta_keywords] => Array ( [type] => 3 [lang] => 1 [validate] => isGenericName [size] => 255 ) [meta_title] => Array ( [type] => 3 [lang] => 1 [validate] => isGenericName [size] => 255 ) [link_rewrite] => Array ( [type] => 3 [lang] => 1 [validate] => isLinkRewrite [required] => [size] => 128 [ws_modifier] => Array ( [http_method] => 2 [modifier] => modifierWsLinkRewrite ) ) [name] => Array ( [type] => 3 [lang] => 1 [validate] => isCatalogName [required] => [size] => 128 ) [description] => Array ( [type] => 6 [lang] => 1 [validate] => isCleanHtml ) [description_short] => Array ( [type] => 6 [lang] => 1 [validate] => isCleanHtml [size] => 833 ) [available_now] => Array ( [type] => 3 [lang] => 1 [validate] => isGenericName [size] => 255 ) [available_later] => Array ( [type] => 3 [lang] => 1 [validate] => IsGenericName [size] => 255 ) ) [associations] => Array ( [manufacturer] => Array ( [type] => 1 ) [supplier] => Array ( [type] => 1 ) [default_category] => Array ( [type] => 1 [field] => id_category_default [object] => Category ) [tax_rules_group] => Array ( [type] => 1 ) [categories] => Array ( [type] => 2 [field] => id_category [object] => Category [association] => category_product ) [stock_availables] => Array ( [type] => 2 [field] => id_stock_available [object] => StockAvailable [association] => stock_availables ) [l] => Array ( [type] => 2 [field] => id_product [foreign_field] => id_product ) ) [classname] => Product ) [update_fields:protected] => [force_id] => ) [cookie] => Cookie Object ( [_content:protected] => Array ( [date_add] => 2019-03-25 14:51:49 [id_lang] => 1 [detect_language] => 1 [id_employee] => 1 [email] => [email protected] [profile] => 1 [passwd] => $2y$10$EHSyXeiFyhYRz0bpCzj9DObIzgp8VAry4BStp/stiHJmdRIeO50.S [remote_addr] => -1753271942 [shopContext] => s-1 [checksum] => 1470501473 ) [_name:protected] => PrestaShop-db06bea1123bf904f18d0f1785e65801 [_expire:protected] => 1556617794 [_domain:protected] => www.prestashop.lenclosdesvins.com [_path:protected] => / [cipherTool:protected] => PhpEncryption Object ( ) [_modified:protected] => [_allow_writing:protected] => 1 [_salt:protected] => Kma9JhHo [_standalone:protected] => [_secure:protected] => ) [cart] => [altern] => 2 )
  9. Merci beaucoup. Je suis en 1.7.5. J'essaye depuis ce matin de filtrer mais j'obtiens désespérément des chaines vides avec : $this->context->controller->php_self ; Dispatcher::getInstance()->getController(); et Tools::getValue('controller'); grrr....comment savoir sur quel controller je suis ?
  10. Merci. Du coup, cela ne va s'executer chaque fois qu'un objet quelconque autre qu'un produit est mis a jour ?
  11. Bonjour, Je souhaite mettre à jour une table en fonction de valeur de caractéristique. J'ai mis le traitement sur le hookActionProductSave. Or voici ce qu'il se passe. Je suis sur la fiche produit. Je change une valeur de caractéristique et j'enregistre. Mon traitement se passe bien MAIS avec la valeur des anciennes caractéristiques. Si je ré enregistre le produit juste après, les nouvelles valeurs sont prises en compte. J'en conclue que le hookActionProductSave s'execute juste avant l'enregistrement du produit. Il y a t il un hook pour exécuter un traitement juste APRES l'enregistrement du produit ? Merci d'avance.
  12. Bonjour, J'essaye de créer un module avec une foreign key. Donc si je desinstalle le module, je veux supprimer la foreign key. $query = "SELECT COUNT(*) FROM information_schema.columns WHERE table_name = 'ps_product_attribute_shop' AND column_name = 'id_wineos_attribute'"; $results = Db::getInstance(_PS_USE_SQL_SLAVE_)->Execute($query); if( $results != 0 ){ $sql[] = "SET SQL_MODE='ALLOW_INVALID_DATES'"; $sql[] = 'ALTER TABLE `' . _DB_PREFIX_ . 'product_attribute_shop` ADD `id_wineos_attribute` INT(11) NULL, ADD CONSTRAINT `fk_id_wineos_attribute` FOREIGN KEY (`id_wineos_attribute`) REFERENCES `' . _DB_PREFIX_ . 'wineos_attribute`(`id_wineos_attribute`)'; } Alors que la foreign key n'existe pas, à la reinitialisation du module, cela me met : Error! Exception retournée par le module wineos_attribute pour reset. Erreur lors de la réinitialisation du module wineos_attribute. Can't DROP 'fk_id_wineos_attribute'; check that column/key exists ALTER TABLE `ps_product_attribute_shop` DROP FOREIGN KEY `fk_id_wineos_attribute` Je ne comprends pas...merci de votre aide.
  13. Hi, I'm trying to display the $product.attributes in product list like in the product page. So I try to adapt the product-variant.tpl to the product list. So I change $groups by $product.attributes ( {foreach from=$product.attributes key=id_attribute_group item=group} ) BUT the var $group.group_type is undefined....:/ how to solve it ? Regards
  14. It works....but the right block don't stop with the product max. let cartAction = parseCartAction($target, event.namespace); let requestData = { ajax: '1', qty: $target[0].step, action: 'update' };
  15. I found or almost : cart.js ...around line 140 : let requestData = { ajax: '1', action: 'update', }; to change to : let requestData = { ajax: '1', qty: '6', action: 'update', op: 'up' }; now....I have to try the change dynamically qty and op...if you have an idea ? regards
×
×
  • Create New...