Jump to content

Sami59100

Members
  • Posts

    7
  • Joined

  • Last visited

Profile Information

  • First Name
    Sami
  • Last Name
    Menouar

Sami59100's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi, I have a customization field on my product page, and I've managed to edit the add function of the ajax-cart.js file, and the Cart class, for it to be added on the database in the cart_product table, in a custom field. I've also managed that when we personnalise the product again, and add it to the cart again, the code also checks my custom field, to have 2 lines of the same product on the cart, but with different custom codes. What I'm not able to do, is to delete a product when there is the same product with a different custom code in the cart, both the products gets deleted. I've tried to do like for the add function, I've added my custom field in the products's "data-id" in the cart page, which allows me to get that custom field in the ajax-cart.js file, like follows : if (!customizationId) { //retrieve idProduct and idCombination from the displayed product in the block cart var firstCut = $(this).parent().parent().data('id').replace('cart_block_product_', ''); firstCut = firstCut.replace('deleteCustomizableProduct_', ''); ids = firstCut.split('_'); productId = parseInt(ids[0]); MYCUSTOMCODE = ids[3]; if (typeof(ids[1]) != 'undefined') productAttributeId = parseInt(ids[1]); if (typeof(ids[2]) != 'undefined') idAddressDelivery = parseInt(ids[2]); } ajaxCart.remove(productId, productAttributeId, customizationId, idAddressDelivery, MYCUSTOMCODE); Then, in the remove function in that same file, I do : remove : function(idProduct, idCombination, customizationId, idAddressDelivery, MYCUSTOMCODE){ [...] data: 'controller=cart&delete=1&id_product=' + idProduct + '&ipa=' + ((idCombination != null && parseInt(idCombination)) ? idCombination : '') + ((customizationId && customizationId != null) ? '&id_customization=' + customizationId : '') + '&id_address_delivery=' + idAddressDelivery + '&MYCUSTOMCODE=' + MYCUSTOMCODE + '&token=' + static_token + '&ajax=true', But I don't know what to do next. I've tried the forums, and everything that passed through my mind with the Cart class, and the cart controller, but with no success That's why I'm coming to you, hoping you'll be able to help me. Hoping that I made everyhting clear. Thanks in advance !
  2. Bonjour, J'ai un champs personalisation sur ma page produit, et j'ai réussi a modifier la fonction add du fichier ajax-cart.js, et le fichier Cart.php, pour que cela s'ajoute dans la base de données dans la table cart_product, dans un nouveau champs préalablement crée. J'ai également réussi à faire en sorte que lorsque l'on repersonnalise le même produit, puis l'ajoute au panier, on vérifie également le champs de personnalisation pour vérifier que c'est bien un produit différent, et donc au final j'ai deux lignes dans mon panier. Ce que je n'arrive pas, c'est pour supprimer un des produits du panier, dans le cas où il y a deux fois le même produit, mais avec des codes de personnalisation différents. J'ai tenté de faire comme pour add de ajax-cart, j'ai rajouter mon code personnalisation dans le data-id du produit dans le panier, ce qui fait que j'arrive logiquement à le récupérer dans le ajax-cart dans cette partie : if (!customizationId) { //retrieve idProduct and idCombination from the displayed product in the block cart var firstCut = $(this).parent().parent().data('id').replace('cart_block_product_', ''); firstCut = firstCut.replace('deleteCustomizableProduct_', ''); ids = firstCut.split('_'); productId = parseInt(ids[0]); MONCODEPERSO = ids[3]; if (typeof(ids[1]) != 'undefined') productAttributeId = parseInt(ids[1]); if (typeof(ids[2]) != 'undefined') idAddressDelivery = parseInt(ids[2]); } ajaxCart.remove(productId, productAttributeId, customizationId, idAddressDelivery, MONCODEPERSO); Ensuite, dans la définition de la fonction remove, je fais comme suit : remove : function(idProduct, idCombination, customizationId, idAddressDelivery, MONCODEPERSO){ [...] data: 'controller=cart&delete=1&id_product=' + idProduct + '&ipa=' + ((idCombination != null && parseInt(idCombination)) ? idCombination : '') + ((customizationId && customizationId != null) ? '&id_customization=' + customizationId : '') + '&id_address_delivery=' + idAddressDelivery + '&moncodeperso=' + MONCODEPERSO + '&token=' + static_token + '&ajax=true', Mais maintenant, je ne sais plus ce que je dois faire. J'ai beau cherché sur les forums depuis quelques jours, avoir testé tout ce qui m'est passé par la tête avec la classe Cart et le controller du même nom, mais malheureusement mission impossible. C'est pourquoi je viens maintenant faire appel à vous, en espérant que vous pourrez m'apporter votre aide. J'espère avoir été clair avec mon problème. Merci d'avance !
  3. Please. I use the htaccess technique for now, but it's not great as I explained...
  4. Yes, but I'd have to do it manually for every product, and modify the .htaccess everytime I change products. I was looking for something to modify in the Category controller. I was thinking get the number of products in the subcategory in the controller, pass it to template, and in the template, if I see a subcategory with only one product, I directly link to the product instead of the category. But I don't know how to do this, or if there is a bette way to do it. Thanks !
  5. Hi I have category page, with all its subcategories. And i'd like that when someone click on a subcategory, he is redirected automatically to the only product of a category. Because each subcategories has only one product, so I find it weird to arrive in a page with only one product listed, and having to click again. I want to delete a step. I've looked it up but can't find a way to do it, is it possible ? If yes, how ? Thanks !
  6. Hi, I'm using GrooveFX for Prestashop to personnalise my items, and I added a hidden field in the form#buy_block in the p.hidden section of the product.tpl file. I'd like to get that variable in the cart, in the bill and all, to know the effect applied to the customer's item. But I don't know where or how to do this. I've found this topic => https://www.prestashop.com/forums/topic/292311-how-to-pass-value-from-tpl-file-to-controller-using-jquery/ But I don't know where to put the variable in the cart.php file, and don't know if this will be enough the have it in the bill, and in the mail sent to the admin for the order. Thanks in advance.
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More