Jump to content
otzy

How to remove save button for customized fields?

Recommended Posts

Is it possible to save customized fields at the same time when Add to cart was clicked?

  • Like 2

Share this post


Link to post
Share on other sites

Everything is possible :)

I have not looked into what it would take, but it's probably a few hours of work.

I offer a module on my shop which lets you use regular attributes at text box, file upload or text area, that also allows you to assign a price / weight impact to them.

You can see a demo and more info at http://www.prestashop.com/forums/viewthread/47363/

Share this post


Link to post
Share on other sites

Tomer, your module is great but unfortunately not exactly that I need.

I did it :)
Some more than a few hours and few changes in /modules/blockcart/ajax-cart.js and /cart.php

Share this post


Link to post
Share on other sites

Can you post exactly how you did it? It is a frequent request.

Share this post


Link to post
Share on other sites

1. /cart.php

 

add function:

 

function textRecord(Product $product, Cart $cart)
{
global $errors;

if (!$fieldIds = $product->getCustomizationFieldIds())
	return false;
$authorizedTextFields = array();
foreach ($fieldIds AS $fieldId)
	if ($fieldId['type'] == _CUSTOMIZE_TEXTFIELD_)
		$authorizedTextFields[intval($fieldId['id_customization_field'])] = 'textField'.intval($fieldId['id_customization_field']);
$indexes = array_flip($authorizedTextFields);
foreach (array_merge($_POST, $_GET) AS $fieldName => $value)
	if (in_array($fieldName, $authorizedTextFields) AND !empty($value))
	{
		if (!Validate::isMessage($value))
			$errors[] = Tools::displayError('Invalid message');
		else
			$cart->addTextFieldToProduct(intval($product->id), $indexes[$fieldName], $value);
	}
	elseif (in_array($fieldName, $authorizedTextFields) AND empty($value))
		$cart->deleteTextFieldFromProduct(intval($product->id), $indexes[$fieldName]);
}

it is taken from product.php and $_GET parameters are added to foreach cycle.

 

2. /cart.php

 

insert lines:

 

			/* save text customization fields */
		if (Tools::isSubmit('submitCustomizedDatas'))
		{
			textRecord($producToAdd, $cart);
		}

 

after these lines:

 

	else
{
	$producToAdd = new Product(intval($idProduct), false, intval($cookie->id_lang));
	if ((!$producToAdd->id OR !$producToAdd->active) AND !$delete)
		$errors[] = Tools::displayError('product is no longer available');
	else
	{

 

3. /modules/blockcart/ajax-cart.js

 

in the add function insert lines before $.ajax:

 

		//add customized text fields
	var customizedData = "",
		re=/^textField\d+/;
	if ((CUSTOMIZE_TEXTFIELD == 1) && (document.getElementById("customizationForm") != null)){
		var customizedForm=document.getElementById("customizationForm");
		for (var i=0; i				if (re.test(customizedForm.elements[i].name)){
				customizedData += "&" + customizedForm.elements[i].name + "=" + customizedForm.elements[i].value;
			}
		}
		customizedData += "&submitCustomizedDatas=1";
	}

and change lines in $.ajax call:

 

		$.ajax({
		type: 'POST',
		url: baseDir + 'cart.php?' + 'add&ajax=true&qty;=' + ( (quantity && quantity != null) ? quantity : '1') + '&id;_product=' + idProduct + '&token;=' + static_token + ( (parseInt(idCombination) && idCombination != null) ? '&ipa;=' + parseInt(idCombination): '') + customizedData ,
		async: true,
		cache: false,
		dataType : "json",
//			data: ,

 

4. It works only with text fields. You may also remove Save button in customizationForm. Tested in Firefox 3.5.15, IE 7, Opera 10.63

 

 

2012-11-12 - attached cart.zip which contains ajax-cart.js and cart.php

ajax-cart.js

cart.php

cart.zip

Edited by otzy
  • Like 5

Share this post


Link to post
Share on other sites
it is working fine also with a textarea, except that the lines in the textarea are not reserved. any ideas how to solve this?

what do you mean "the lines in the textarea are not reserved"?
You get on the server only the first line of your textarea?

try to use escape function in ajax-cart.js
//add customized text fields
       var customizedData = "",
           re=/^textField\d+/;
       if ((CUSTOMIZE_TEXTFIELD == 1) && (document.getElementById("customizationForm") != null)){
           var customizedForm=document.getElementById("customizationForm");
           for (var i=0; i                if (re.test(customizedForm.elements[i].name)){
                   customizedData += "&" + customizedForm.elements[i].name + "=" + escape(customizedForm.elements[i].value);
               }
           }
           customizedData += "&submitCustomizedDatas=1";
       }

Share this post


Link to post
Share on other sites

i meant that if i write in the textarea:

test text row1
test row2
row3

it will result (both on the cart and in the db) => "test text row1test row2row3"

if i use your code from the previous post, it gives me a technical error.

Share this post


Link to post
Share on other sites

New recipe

ajax-cart.js:

        //add customized text fields
       var customizedData = "",
           re=/^textField\d+/;
       if ((CUSTOMIZE_TEXTFIELD == 1) && (document.getElementById("customizationForm") != null)){
           var customizedForm=document.getElementById("customizationForm");
           for (var i=0; i                if (re.test(customizedForm.elements[i].name)){
                   customizedData += "&" + customizedForm.elements[i].name + "=" + customizedForm.elements[i].value.replace("\n","
");
               }
           }
           customizedData += "&submitCustomizedDatas=1";
       }



after this change there will be normal rows in database fields, but you will still have an error after "add to cart".
To correct this replace CRLF with value with some characters suitable for your theme (br or \n or space)

example for space
classes/Product.php:

    static public function getAllCustomizedDatas($id_cart, $id_lang = null)
   {
       global $cookie;
       if (!$id_lang AND $cookie->id_lang)
           $id_lang = $cookie->id_lang;
       else
       {
           $cart = new Cart(intval($id_cart));
           $id_lang = intval($cart->id_lang);
       }

       if (!$result = Db::getInstance()->ExecuteS('
           SELECT cd.`id_customization`, c.`id_product`, cfl.`id_customization_field`, c.`id_product_attribute`, cd.`type`, cd.`index`, 
               replace(replace(cd.`value`,char(13)," "),char(10),"") as value, 
               cfl.`name`
           FROM `'._DB_PREFIX_.'customized_data` cd
           NATURAL JOIN `'._DB_PREFIX_.'customization` c
           LEFT JOIN `'._DB_PREFIX_.'customization_field_lang` cfl ON (cfl.id_customization_field = cd.`index` AND id_lang = '.intval($id_lang).')
           WHERE c.`id_cart` = '.intval($id_cart).'
           ORDER BY `id_product`, `id_product_attribute`, `type`, `index`'))
           return false;
       $customizedDatas = array();
       foreach ($result AS $row)
           $customizedDatas[intval($row['id_product'])][intval($row['id_product_attribute'])][intval($row['id_customization'])]['datas'][intval($row['type'])][] = $row;
       if (!$result = Db::getInstance()->ExecuteS('SELECT `id_product`, `id_product_attribute`, `id_customization`, `quantity`, `quantity_refunded`, `quantity_returned` FROM `'._DB_PREFIX_.'customization` WHERE `id_cart` = '.intval($id_cart)))
           return false;
       foreach ($result AS $row)
       {
           $customizedDatas[intval($row['id_product'])][intval($row['id_product_attribute'])][intval($row['id_customization'])]['quantity'] = intval($row['quantity']);
           $customizedDatas[intval($row['id_product'])][intval($row['id_product_attribute'])][intval($row['id_customization'])]['quantity_refunded'] = intval($row['quantity_refunded']);
           $customizedDatas[intval($row['id_product'])][intval($row['id_product_attribute'])][intval($row['id_customization'])]['quantity_returned'] = intval($row['quantity_returned']);
       }
       return $customizedDatas;
   }

  • Like 1

Share this post


Link to post
Share on other sites

Hi,
in order to calculate area and perimeter, i need to save customized field BEFORE adding product to the cart, but i'd like to remove save button..
How can i resolve my problem???

Pleaseeeee help meeeeee :)

Share this post


Link to post
Share on other sites

Possibly you should write some javascript that will make calculation before posting data to the server

Share this post


Link to post
Share on other sites

Otzy, i've proved your solution in order to remove save button, but i've had some problem with ajax cart: it's showed without total price.. can you tell me why?? ^_^

Share this post


Link to post
Share on other sites

It doesn't work for me in presta 1.3.1 and IE 8, nor FF 3.6.13 nor Opera 10.61.
Behaviour:
1.- Load the product
2.- Select that I want a printed card (attribute Printed and Unprinted for a card)
3.- In the attributes section, I write the text and the color of letters (2 text fields)
4.- I dont click the Save button, I just click Add to cart
5.- It redirects to Cart.php without having introduced the attributes
If I go back, the textfields are filled in, they behave as if they had been saved with the button, but they are not added
to the cart.

How could I solve it? Has anybody had the same result with this change?

Thanks in advance.

Share this post


Link to post
Share on other sites
Otzy, i've proved your solution in order to remove save button, but i've had some problem with ajax cart: it's showed without total price.. can you tell me why?? ^_^

It is unlikely that this solution caused the total price error. Could you send firebug console output (request and response parameters and bodies) occured after click to Add to cart button.

Share this post


Link to post
Share on other sites
It doesn't work for me in presta 1.3.1 and IE 8, nor FF 3.6.13 nor Opera 10.61.
Behaviour:
1.- Load the product
2.- Select that I want a printed card (attribute Printed and Unprinted for a card)
3.- In the attributes section, I write the text and the color of letters (2 text fields)
4.- I dont click the Save button, I just click Add to cart
5.- It redirects to Cart.php without having introduced the attributes
If I go back, the textfields are filled in, they behave as if they had been saved with the button, but they are not added
to the cart.

How could I solve it? Has anybody had the same result with this change?

Thanks in advance.


I had no dealings with PS 1.3.1 but it looks like you did not enable ajax cart.
Back Office -> Modules -> Blocks -> Cart block -> Configure

I have changed only ajax call in my solution so it will not work with ajax disabled

Share this post


Link to post
Share on other sites
example for space
classes/Product.php:


otzy, would you please give me the example with the "br"? Sorry, but i'm not a programmer...

+ unfortunately your example is working only for the first row. the other ones are written still continously.

thanks!

Share this post


Link to post
Share on other sites
example for space
classes/Product.php:


otzy, would you please give me the example with the "br"? Sorry, but i'm not a programmer...

+ unfortunately your example is working only for the first row. the other ones are written still continously.

thanks!


Example for br, but I'm not sure if it will work. It depends on how Prestashop processes html tags in your case.
static public function getAllCustomizedDatas($id_cart, $id_lang = null)
   {
       global $cookie;
       if (!$id_lang AND $cookie->id_lang)
           $id_lang = $cookie->id_lang;
       else
       {
           $cart = new Cart(intval($id_cart));
           $id_lang = intval($cart->id_lang);
       }

       if (!$result = Db::getInstance()->ExecuteS('
           SELECT cd.`id_customization`, c.`id_product`, cfl.`id_customization_field`, c.`id_product_attribute`, cd.`type`, cd.`index`, 
               replace(replace(cd.`value`,char(13),"
"),char(10),"") as value, 
               cfl.`name`
           FROM `'._DB_PREFIX_.'customized_data` cd
           NATURAL JOIN `'._DB_PREFIX_.'customization` c
           LEFT JOIN `'._DB_PREFIX_.'customization_field_lang` cfl ON (cfl.id_customization_field = cd.`index` AND id_lang = '.intval($id_lang).')
           WHERE c.`id_cart` = '.intval($id_cart).'
           ORDER BY `id_product`, `id_product_attribute`, `type`, `index`'))
           return false;
       $customizedDatas = array();
       foreach ($result AS $row)
           $customizedDatas[intval($row['id_product'])][intval($row['id_product_attribute'])][intval($row['id_customization'])]['datas'][intval($row['type'])][] = $row;
       if (!$result = Db::getInstance()->ExecuteS('SELECT `id_product`, `id_product_attribute`, `id_customization`, `quantity`, `quantity_refunded`, `quantity_returned` FROM `'._DB_PREFIX_.'customization` WHERE `id_cart` = '.intval($id_cart)))
           return false;
       foreach ($result AS $row)
       {
           $customizedDatas[intval($row['id_product'])][intval($row['id_product_attribute'])][intval($row['id_customization'])]['quantity'] = intval($row['quantity']);
           $customizedDatas[intval($row['id_product'])][intval($row['id_product_attribute'])][intval($row['id_customization'])]['quantity_refunded'] = intval($row['quantity_refunded']);
           $customizedDatas[intval($row['id_product'])][intval($row['id_product_attribute'])][intval($row['id_customization'])]['quantity_returned'] = intval($row['quantity_returned']);
       }
       return $customizedDatas;
   } 



Correction for all occurences of the new line:

        //add customized text fields
       var customizedData = "",
           re=/^textField\d+/;
       if ((CUSTOMIZE_TEXTFIELD == 1) && (document.getElementById("customizationForm") != null)){
           var customizedForm=document.getElementById("customizationForm");
           for (var i=0; i                if (re.test(customizedForm.elements[i].name)){
                   customizedData += "&" + customizedForm.elements[i].name + "=" + customizedForm.elements[i].value.replace(/\n/g,"
");
               }
           }
           customizedData += "&submitCustomizedDatas=1";
       }



I noticed that code inclusion replaced quoted characters.
You have to type function as follow but delete space after %:

customizedData += "&" + customizedForm.elements[i].name + "=" + customizedForm.elements[i].value.replace(/\n/g,"% 0D% 0A
");

  • Like 1

Share this post


Link to post
Share on other sites

leaving the Product.php as it is by default and making the above fixes in the ajax-cart.js resulted in a fully functional customization TEXTAREA WITHOUT any SAVE BUTTON.

thank you otzy, you are great!

Share this post


Link to post
Share on other sites

I did this and it works! Thank you soo much!!!

Can you help me find the right place to get rid of the actual save button and related instructions now? (see attachment)

Mimib

36029_2c49YZx9wDeaoGOoQIkZ_t

Share this post


Link to post
Share on other sites
I did this and it works! Thank you soo much!!!

Can you help me find the right place to get rid of the actual save button and related instructions now? (see attachment)

Mimib


/themes/YourTheme/product.tpl

find and delete line 436(if YourTheme=prestashop). It begins with:
[pre]<input type="button" class="button" value="{l s='Save'}"[/pre]and this button has onclick saveCustomization()
(I can not show here the full line as this forum detruncate javascript in html tags)

Share this post


Link to post
Share on other sites

Otzy,

You're brilliant! It works perfectly. I moved it up into the add-to-cart area too and so now the customer will make their customization selection along with their attribute selections (see it here... http://princewatch.com/prestashop/calfskin-watch-band/10-fluco-record-black-long.html ) I'm still building the site, but this was a big step forward.

I tried to do one more thing to it, but was unsuccessful. Do you think it's possible to make the customization input type be a checkbox instead of a text box? I tried just changing this line it in the product.tpl, but it stopped working.

<input type="text" name="textField{$field.id_customization_field}" id="textField{$customizationField}" value="{if isset($textFields.$key)}{$textFields.$key|stripslashes}{/if}" class="customization_block_input" />

That way, they can just check a box if they want the buckle changed instead of typing the color they want. (I secretly REALLY like radio buttons for this, but I'm pretty sure that's asking too much)

Thanks again -mimi

Share this post


Link to post
Share on other sites
Otzy,

You're brilliant! It works perfectly. I moved it up into the add-to-cart area too and so now the customer will make their customization selection along with their attribute selections (see it here... http://princewatch.com/prestashop/calfskin-watch-band/10-fluco-record-black-long.html ) I'm still building the site, but this was a big step forward.

I tried to do one more thing to it, but was unsuccessful. Do you think it's possible to make the customization input type be a checkbox instead of a text box? I tried just changing this line it in the product.tpl, but it stopped working.
<input type="text" name="textField{$field.id_customization_field}" id="textField{$customizationField}" value="{if isset($textFields.$key)}{$textFields.$key|stripslashes}{/if}" class="customization_block_input" />

That way, they can just check a box if they want the buckle changed instead of typing the color they want. (I secretly REALLY like radio buttons for this, but I'm pretty sure that's asking too much)

Thanks again -mimi



Unfortunately I have no enough time now but if you familiar with Javascript you may try the following solution.

Change the type of text field from input type="text" to input type="hidden"
Then add your checkboxes or radiobuttons and add listener on click event to these elements.
In event hadler you change the values of hidden fields according to clicked radiobutton.

You may design different sets of radiobuttons for differrent products

Share this post


Link to post
Share on other sites
this isnt working for me...
i am using 1.3.5...
can anyone help
thanks


I have updated my Prestashop to 1.3.5 and this works.
Actually there were not changes of customized fields handling in this version.

It may well be that you did not apply some guidelines

Share this post


Link to post
Share on other sites

Ah ok.
Maybe im doing something wrong.

What steps/posts am i meant to follow? And in which order?

Share this post


Link to post
Share on other sites

the necessary steps are in the post 5

If you use textarea make changes from the post 18 of this thread.

Do not use files attached to post 5, they are from version 1.3.2. You have to modify your 1.3.5 files.

Share this post


Link to post
Share on other sites

I have the same problem (with version 1.3.7). I have modified the upon files (otzy-files) and as a result when i press the "Save to Cart" button i have the following message "product not found" . Anybody...help??

Share this post


Link to post
Share on other sites
Can nobody do this?????????????? Please help

I did not check how it works in 1.4
Have you tried to apply 1.3.5 solution for 1.4?

Share this post


Link to post
Share on other sites

Some codes that are listed have completely changed in 1.4 and not sure what to change etc...

Share this post


Link to post
Share on other sites
Can no one help me out here!?!?!?!?!


I will definitely give it a try. Actually, I need this for a new store I am designing for an auto body shop. They will have two text input boxes and I want to remove the 'Save' button. I've also moved the customizations to just above the quanity and 'Add to Cart' button. It looks much better up there. I hate the other way of putting it in the tabs below. Hopefully Prestashop will change this in future editions.

It will be a few days but I will have it working in 1.4 if you can wait. Once I get it working I'll be glad to tell you what I did.

Marty Shue

Share this post


Link to post
Share on other sites

Hi Marty,
I have also done the same, i agree, they are totally out the way at the bottom of the page. And why the save button isn't intergrated in the first place I don't know.

That would be great if you can let me know.

Thanks a lot!

Share this post


Link to post
Share on other sites

I need a code to delete the "save" button (for text fields)..... My customers NEVER clic on it............ So i have to contact them manually to know their customisations ! You don't imagine how it grows my work.... Please developpers and/or prestashop fans..... Please give us a good code to delete this save button! ..... (for version 1.4.1)

Share this post


Link to post
Share on other sites

ive added the changes to my product.tpl
but for some reason it is not showing any changes in my store?
ive even deleted it for a good while and replaced it with the new one but still no change??
totally confusing. im using 1.4

Share this post


Link to post
Share on other sites

Yeah.. Go to Back office (admin) -> Preferences -> Performances ->

force compilation: yes
cache: no

for a development environment. Don't forget to switch for production.

Changes will work now :)

Share this post


Link to post
Share on other sites

thanks that worked. I thought that would fix my problem but still am having issues with my customization fields.
Only if the product has one custom field, my customers can save by pressing Enter (not by pressing save)
but if there are more than 2 fields, enter does work. Its really limiting my sales. Anybody have this issue?

Share this post


Link to post
Share on other sites

I have a couple of problems with this on ve 1.3.1.

Firstly, if I add a product with a customized field to the cart and then try and add the product again, but with a different customized field (say someone is buy the same tshirt for two different peopel and therefore wants two different names printed on them), the previous cutomised field is saved, not the latest one. This happens even if you navigate away from the page and then back again to add the second product.

How can I stop this from happening? I think it must have something to do with cookies since even if I navigate away from the page and then back again, the customized field is preopulated with the first name added.

Removing the save button is something I have been trying to do for ages and now I am so tantelisingly close, I am desperate to sort out this one last issue!

Share this post


Link to post
Share on other sites

could you give me a link to your site

Share this post


Link to post
Share on other sites

I haven't set any of my changes live yet - I am working on my test server on my local computer until I get it working correctly.

Share this post


Link to post
Share on other sites
I haven't set any of my changes live yet - I am working on my test server on my local computer until I get it working correctly.

Customizations are sent not in cookies but as GET parameters in the ajax request. I think there is some wrong in ajax-cart.js
But I am not sure as I did not touch your site.

Share this post


Link to post
Share on other sites

OK, well there are two sections in the ajax-cart.js that refer to $.ajax I edited the firs as per your instruction but not the second - could this be the issue?

            // save the expand statut in the user cookie
           $.ajax({            
                  type: 'POST',            
                  url: baseDir + 'cart.php?' + 'add&ajax=true&qty;=' + ( (quantity && quantity != null) ? quantity : '1') + '&id;_product=' + idProduct + '&token;=' + static_token + ( (parseInt(idCombination) && idCombination != null) ? '&ipa;=' + parseInt(idCombination): '') + customizedData ,            
                  async: true,            
                  cache: false,            
                  dataType : "json",
   //            data: , 
           });


       }
   },

   // cart to fix display when using back and previous browsers buttons
   refresh : function(){
       //send the ajax request to the server
       $.ajax({
           type: 'GET',
           url: baseDir + 'cart.php',
           async: true,
           cache: false,
           dataType : "json",
           data: 'ajax=true&token;=' + static_token,
           success: function(jsonData)
           {
               ajaxCart.updateCart(jsonData)
           },
           error: function(XMLHttpRequest, textStatus, errorThrown) {
               //alert("TECHNICAL ERROR: unable to refresh the cart.\n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
           }
       });

Share this post


Link to post
Share on other sites

Actually, there are a number of points where $.ajax is mentioned - which do I need to change?

The commented sections for each $.ajax read:
// save the expand statut in the user cookie (line 91)
//send the ajax request to the server (line 107)
// save the expand statut in the user cookie (line 140)
//send the ajax request to the server (line 167)
//send the ajax request to the server (line 215)

Share this post


Link to post
Share on other sites

Unfortunately I have no original ajax-cart.js of your version. So I do not know the right line number.

You have to add code and change $.ajax in the add function. Find something like this:

   // add a product in the cart via ajax
   add : function(idProduct, idCombination, addedFromProductPage, callerElement, quantity, whishlist){



and add code there

Share this post


Link to post
Share on other sites

Hmm, well I tried chagning that bit and reverting the bit I had done before by mistake and now it doesn't work at all! I have attached the original ajax-cart.js file - if you wouldn't mind having a quick look for me to let me know which bits I should be editing?


EDIT - don't worry - sorted now!

Share this post


Link to post
Share on other sites

Aha! Scrap that as I have now done a bit of detective work looking at the file you attached to post 5 (don't know why I didn't look at that first!) and have now got it working nicely. Thank you!

Share this post


Link to post
Share on other sites

So sorry, me again!

OK, the changes have gone live (http://www.pitterpatterproducts.co.uk) now on my client's site and I have noticed problems I hadn't seen before:

On IE7, the animation is not shown on add to cart and sometimes the item is not added at all.

On Firefox, the item is added but then instantly removed.

In Safari for windows, I get this error: TECHNICAL ERROR: unable to add the product. Details: Error thrown: [object XMLHttpRequest] Text status: error

Now that it is live, I obviously need to get this sorted as quickly as possible.

Share this post


Link to post
Share on other sites

Phew! I found the problem - so sorry to be a pain... I panicked what with it being live now! At some point in the thread someone said you needed to add an onclick to the add to cart button. I have now removed this and it is working nicely in each of the browsers I mentioned.

Panic over!

Share this post


Link to post
Share on other sites
Phew! I found the problem - so sorry to be a pain... I panicked what with it being live now! At some point in the thread someone said you needed to add an onclick to the add to cart button. I have now removed this and it is working nicely in each of the browsers I mentioned.

Panic over!

:) while I was mining your site it got fine. Good luck

Share this post


Link to post
Share on other sites

probably it's a bug of jQuery unbind() - I don't know why but it did not unbind onclick assigned in html.

Share this post


Link to post
Share on other sites

babyewok What version of Prestashop are you using as I've followed this thread perfectly serveral times and its not working at all in the way your site does. I really dont understand what I've got wrong for it not to work...

Thanks in Advance

Dan.

Share this post


Link to post
Share on other sites

Thanks babyewok,

I've just got it working on a clean install of 1.3.1 but i think my site uses 1.3.6 or 1.3.7 Im going to take a look at the differnces now.

Share this post


Link to post
Share on other sites

Has anyone got issues with this hack and the "AJAX Dropdown Categories v1.5.5" When I enable that mod this hack stops working.

It looks like its messing with the way that the Ajax cart works.
If anyone can enlighten me on this or help in any way it would be appreciated.

Prestashop Version: 1.3.0 (With this auto save hack manually added as in Post #5)
AJAX Dropdown Categories v1.5.5

Kind Regards
Dan.

Share this post


Link to post
Share on other sites

From digging deeper, It would seem that the module is turning off the Ajax Cart... Is there anyway I can get this hack to work with the Ajax cart disabled?

Cheers
Dan.

Share this post


Link to post
Share on other sites

¿podrías subir los ficheros modificados para probar lo que habéis hecho?

es que estoy intentando adaptarlo para que me recoja campos customizables con otro valores y me da demasiados errores.

Gracias

--------------------------

Could you upload the files modified to test what you have done?

I'm trying to adapt it to pick me up customizable fields with other values ​​and gives me too many errors.

thanks

Share this post


Link to post
Share on other sites

Hello,

Sorry to bother you, but i modified cart.php and ajax-cart.js like you said but i get an error:

 

missing ; after for-loop condition

for (var i=0; i ...st(customizedForm.elements.name)){

can you help me?

 

looks like opening or closing bracket is missing. Check the hole script for errors

Share this post


Link to post
Share on other sites

 

looks like opening or closing bracket is missing. Check the hole script for errors

 

The thing is that before i add this piece of code everything is ok. The error appears after i add the code. I'll try to find that bracket that is missing.

Thanks

Share this post


Link to post
Share on other sites

Hi there,

 

Has anyone figured this out on PS 1.4?

 

I did all the changes mentioned on post 5, adding the function instead of cart.php in controllers/CartController.php and applied the changes to ajax-cart.js but it does not work. The customized fields are not sent to the cart... and the sliding effect into the cart module stopped working.

 

Any idea? I need to get this fixed a.s.a.p because if not the page reloads everytime i click on the Save button and the attributes revert to the default ones. So I need to make it work without the Save button, unless there is a way to ajax the save button but accordint to the PS support team this is not possible.

 

I am willing to pay for this fix in PS 1.4. Get in touch with me.

 

Looking forward to a reply soon!

Share this post


Link to post
Share on other sites

One thing I figured out that could work too is this. The reason PS 1.4 reloads with the default attributes is because the form action="product.php?id_product=4387" just reloads with the id_product=id but in earlier versions of PS, not sure which one now because I am checking on another website built in PS that works fine, it reloads like this action="product.php?id_product=11&group_4=73&group_5=80&group_6=83&group_4=73&group_5=80&group_6=83" with each &group_id=attribute_id being the attribute groups. So it reloads with the attributes the user previously selected. Does anyone know how to implement this in PS 1.4? Where is the function that controls it?

 

Thanx

Share this post


Link to post
Share on other sites

I don't know if this how it's supposed to be, but i think that the code inclusion deleted a part of the the code because the for expression is incomplete. Could you please re-upload the ajax-cart.js or only a txt file with the lines that have to be inserted before $.ajax in the add function?

Share this post


Link to post
Share on other sites

These were the changed I did but weren't working. Instead of cart.php I modified controllers/CartController.php and the ajax-cart.js is the same file. I don't know if the problem could be that my template uses <textarea> instead of <input> for the customization form. However I need a fix for this a.s.a.p. It would be awesome to get rid of the Save Button but i haven't managed to make it work. Any help is appreciated.

 

1. /cart.php

add function:

function textRecord(Product $product, Cart $cart)
{
global $errors;
if (!$fieldIds = $product->getCustomizationFieldIds())
	return false;
$authorizedTextFields = array();
foreach ($fieldIds AS $fieldId)
	if ($fieldId['type'] == _CUSTOMIZE_TEXTFIELD_)
		$authorizedTextFields[intval($fieldId['id_customization_field'])] = 'textField'.intval($fieldId['id_customization_field']);
$indexes = array_flip($authorizedTextFields);
foreach (array_merge($_POST, $_GET) AS $fieldName => $value)
	if (in_array($fieldName, $authorizedTextFields) AND !empty($value))
	{
		if (!Validate::isMessage($value))
			$errors[] = Tools::displayError('Invalid message');
		else
			$cart->addTextFieldToProduct(intval($product->id), $indexes[$fieldName], $value);
	}
	elseif (in_array($fieldName, $authorizedTextFields) AND empty($value))
		$cart->deleteTextFieldFromProduct(intval($product->id), $indexes[$fieldName]);
}

it is taken from product.php and $_GET parameters are added to foreach cycle.

2. /cart.php

insert lines:

			/* save text customization fields */
		if (Tools::isSubmit('submitCustomizedDatas'))
		{
			textRecord($producToAdd, $cart);
		}

after these lines:

	else
{
	$producToAdd = new Product(intval($idProduct), false, intval($cookie->id_lang));
	if ((!$producToAdd->id OR !$producToAdd->active) AND !$delete)
		$errors[] = Tools::displayError('product is no longer available');
	else
	{

3. /modules/blockcart/ajax-cart.js

in the add function insert lines before $.ajax:

		//add customized text fields
	var customizedData = "",
		re=/^textField\d+/;
	if ((CUSTOMIZE_TEXTFIELD == 1) && (document.getElementById("customizationForm") != null)){
		var customizedForm=document.getElementById("customizationForm");
		for (var i=0; i				if (re.test(customizedForm.elements[i].name)){
				customizedData += "&" + customizedForm.elements[i].name + "=" + customizedForm.elements[i].value;
			}
		}
		customizedData += "&submitCustomizedDatas=1";
	}

and change lines in $.ajax call:

		$.ajax({
		type: 'POST',
		url: baseDir + 'cart.php?' + 'add&ajax=true&qty;=' + ( (quantity && quantity != null) ? quantity : '1') + '&id;_product=' + idProduct + '&token;=' + static_token + ( (parseInt(idCombination) && idCombination != null) ? '&ipa;=' + parseInt(idCombination): '') + customizedData ,
		async: true,
		cache: false,
		dataType : "json",
//			data: ,

4. It works only with text fields. You may also remove Save button in customizationForm. Tested in Firefox 3.5.15, IE 7, Opera 10.63

Share this post


Link to post
Share on other sites

Hi there,

 

Has anyone figured this out on PS 1.4?

 

I did all the changes mentioned on post 5, adding the function instead of cart.php in controllers/CartController.php and applied the changes to ajax-cart.js but it does not work. The customized fields are not sent to the cart... and the sliding effect into the cart module stopped working.

 

Any idea? I need to get this fixed a.s.a.p because if not the page reloads everytime i click on the Save button and the attributes revert to the default ones. So I need to make it work without the Save button, unless there is a way to ajax the save button but accordint to the PS support team this is not possible.

 

I am willing to pay for this fix in PS 1.4. Get in touch with me.

 

Looking forward to a reply soon!

 

Bump. I really need to get this working on PS 1.4. Whoever can do it and is sure it will work please send me a quote if not willing to support for free. Is it that hard to update this fix to PS 1.4 if it was working on PS 1.3?? I am not a programmer but I really need this working. My boss told me I need to have it fixed before the weekend :-( Pleaseeeee help.

 

Thanx.

Share this post


Link to post
Share on other sites

I got one textfield on every product and would like to skip the save button.

I need to get this working on PS 1.4.4.1 and willing to pay for the solution.

 

Send me a PM if you know how to solve this!

Share this post


Link to post
Share on other sites

More testing needs to be done, but I think I got this to work in 1.4.6.2

 

CartController.php

Added:

/* save text customization fields - added 1/1/2012*/
if (Tools::isSubmit('submitCustomizedDatas'))
{
	   $this->textRecord($producToAdd);
}

 

Just before (where otzy says to):

/* Check the quantity availability */
if ($idProductAttribute AND is_numeric($idProductAttribute))

 

And I modified otzy's function a bit and added it to the bottom of my CartController.php file:

private function textRecord(Product $product)
{
  		 global $errors;
  		 if (!$fieldIds = $product->getCustomizationFieldIds())
  				 return false;
  		 $authorizedTextFields = array();
  		 foreach ($fieldIds AS $fieldId)
  				 if ($fieldId['type'] == _CUSTOMIZE_TEXTFIELD_)
  						 $authorizedTextFields[intval($fieldId['id_customization_field'])] = 'textField'.intval($fieldId['id_customization_field']);
  		 $indexes = array_flip($authorizedTextFields);
  		 foreach (array_merge($_POST, $_GET) AS $fieldName => $value)
  				 if (in_array($fieldName, $authorizedTextFields) AND !empty($value))
  				 {
  						 if (!Validate::isMessage($value))
  								 $errors[] = Tools::displayError('Invalid message');
  						 else
  								 self::$cart->addTextFieldToProduct(intval($product->id), $indexes[$fieldName], $value);
  				 }
  				 elseif (in_array($fieldName, $authorizedTextFields) AND empty($value))
  						 self::$cart->deleteTextFieldFromProduct(intval($product->id), $indexes[$fieldName]);
}

 

In ajax-cart.js I added otzy's code, but modifed the data: line in the $.ajax call:

data: 'add=1&ajax=true&qty=' + ((quantity && quantity != null) ? quantity : '1') + '&id_product=' + idProduct + '&token=' + static_token + ( (parseInt(idCombination) && idCombination != null) ? '&ipa=' + parseInt(idCombination): '') + customizedData,

 

Lastly, in my product.tpl file, I moved the whole customizable products block into the buy_block form, and took it out of the form it was in. Without moving the customization data into this form, the process won't work. The key thing that drives it all "submitCustomizedDatas" wasn't getting passed otherwise.

Share this post


Link to post
Share on other sites

More testing needs to be done, but I think I got this to work in 1.4.6.2

 

fine, but one remark - it is better not to change core controller file.

 

Copy attached file to /override/controllers/ and you will be happy with future Prestashop updates.

CartController.php

  • Like 1

Share this post


Link to post
Share on other sites

Yes, after I got it working I did move the updated function to the override/contollers folder.

 

Thanks for your help otzy

Share this post


Link to post
Share on other sites

Can you post your code and give us an example for your ajax-cart.js and your product.tpl? I tried to follow your way but no luck. Thanks.

Share this post


Link to post
Share on other sites

Here is my CartController override and my ajax-cart. However I will say, I don't think I use the ajax calls. When ever you add an item in my shop, it takes you directly to the cart. The ajax method didn't fit my needs. In looking at the ajax-cart, it would probably need to be modified to remove the references to "customizationForm" and replace with "buy_block".

 

I didn't attach my product.tpl file because it is now heavily customized. While I wanted the flexability of having text fields on my form, I still wanted the values they could be to be database driven. This now happens with a jquery popup and custom tables much like ps_attribute, ps_product_attribute and ps_product_attribute_combination.

 

 

The CartController.php file is placed in override\controllers

The whole blockcart module has been copied over to my theme\modules folder

 

If you are trying to debug, I highly recommend the combination of eclipse/xdebug and FireFox. Without them, I wouldn't have been able to figure out what was or wasn't really working.

CartController.php

ajax-cart_js.txt

  • Like 1

Share this post


Link to post
Share on other sites

Thanks a lot for your shar and help. I pasted your CartController.php and ajax-cart_js.txt to my cart. Still did not work. I think the problem is in the product.tpl. Here is my product.tpl. I tried to follow your suggestion to put the text field in the buy block. Could you take a look for my code. Sorry I am not a programmer. Thank again.

 

{if ($product->show_price AND !isset($restricted_country_mode)) OR isset($groups) OR $product->reference OR (isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS)}
 <!-- add to cart form-->
 <form id="buy_block" {if $PS_CATALOG_MODE AND !isset($groups) AND $product->quantity > 0}class="hidden"{/if} action="{$link->getPageLink('cart.php')}" method="post">
  <!-- hidden datas -->
  <p class="hidden">
<input type="hidden" name="token" value="{$static_token}" />
<input type="hidden" name="id_product" value="{$product->id|intval}" id="product_page_product_id" />
<input type="hidden" name="add" value="1" />
<input type="hidden" name="id_product_attribute" id="idCombination" value="" />
  </p>

  <div class="product_attributes">
{if isset($groups)}
<!-- attributes -->
<div id="attributes">
{foreach from=$groups key=id_attribute_group item=group}
{if $group.attributes|@count}
<p>
 <label for="group_{$id_attribute_group|intval}">{$group.name|escape:'htmlall':'UTF-8'} :</label>
 {assign var="groupName" value="group_$id_attribute_group"}
 <select name="{$groupName}" id="group_{$id_attribute_group|intval}" onchange="javascript:findCombination();{if $colors|@count > 0}$('#wrapResetImages').show('slow');{/if};">
  {foreach from=$group.attributes key=id_attribute item=group_attribute}
   <option value="{$id_attribute|intval}"{if (isset($smarty.get.$groupName) && $smarty.get.$groupName|intval == $id_attribute) || $group.default == $id_attribute} selected="selected"{/if} title="{$group_attribute|escape:'htmlall':'UTF-8'}">{$group_attribute|escape:'htmlall':'UTF-8'}</option>
  {/foreach}
 </select>
</p>
{/if}
{/foreach}
</div>
{/if}
<p id="product_reference" {if isset($groups) OR !$product->reference}style="display: none;"{/if}><label for="product_reference">{l s='Reference :'} </label><span class="editable">{$product->reference|escape:'htmlall':'UTF-8'}</span></p>
<!-- quantity wanted -->
<p id="quantity_wanted_p"{if (!$allow_oosp && $product->quantity <= 0) OR $virtual OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}>
 <label>{l s='Quantity :'}</label>
 <input type="text" name="qty" id="quantity_wanted" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}{if $product->minimal_quantity > 1}{$product->minimal_quantity}{else}1{/if}{/if}" size="2" maxlength="3" {if $product->minimal_quantity > 1}onkeyup="checkMinimalQuantity({$product->minimal_quantity});"{/if} />
</p>
<!-- minimal quantity wanted -->
<p id="minimal_quantity_wanted_p"{if $product->minimal_quantity <= 1 OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}>{l s='You must add '}<b id="minimal_quantity_label">{$product->minimal_quantity}</b>{l s=' as a minimum quantity to buy this product.'}</p>
{if $product->minimal_quantity > 1}
<script type="text/javascript">
 checkMinimalQuantity();
</script>
{/if}
<!-- availability -->
<p id="availability_statut"{if ($product->quantity <= 0 && !$product->available_later && $allow_oosp) OR ($product->quantity > 0 && !$product->available_now) OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}>
 <span id="availability_label">{l s='Availability:'}</span>
 <span id="availability_value"{if $product->quantity <= 0} class="warning_inline"{/if}>
  {if $product->quantity <= 0}{if $allow_oosp}{$product->available_later}{else}{l s='This product is no longer in stock'}{/if}{else}{$product->available_now}{/if}
 </span>
</p>
<!-- number of item in stock -->
{if ($display_qties == 1 && !$PS_CATALOG_MODE && $product->available_for_order)}
<p id="pQuantityAvailable"{if $product->quantity <= 0} style="display: none;"{/if}>
 <span id="quantityAvailable">{$product->quantity|intval}</span>
 <span {if $product->quantity > 1} style="display: none;"{/if} id="quantityAvailableTxt">{l s='item in stock'}</span>
 <span {if $product->quantity == 1} style="display: none;"{/if} id="quantityAvailableTxtMultiple">{l s='items in stock'}</span>
</p>
{/if}
<!-- Out of stock hook -->
<p id="oosHook"{if $product->quantity > 0} style="display: none;"{/if}>
 {$HOOK_PRODUCT_OOS}
</p>
<p class="warning_inline" id="last_quantities"{if ($product->quantity > $last_qties OR $product->quantity <= 0) OR $allow_oosp OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if} >{l s='Warning: Last items in stock!'}</p>
{if $product->online_only}
 <p>{l s='Online only'}</p>
{/if}
  </div>
  <div class="content_prices clearfix">
<!-- prices -->
{if $product->show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}
<div class="price">
 {if !$priceDisplay || $priceDisplay == 2}
  {assign var='productPrice' value=$product->getPrice(true, $smarty.const.NULL)}
  {assign var='productPriceWithoutRedution' value=$product->getPriceWithoutReduct(false, $smarty.const.NULL)}
 {elseif $priceDisplay == 1}
  {assign var='productPrice' value=$product->getPrice(false, $smarty.const.NULL)}
  {assign var='productPriceWithoutRedution' value=$product->getPriceWithoutReduct(true, $smarty.const.NULL)}
 {/if}

 <p class="our_price_display">
 {if $priceDisplay >= 0 && $priceDisplay <= 2}
  <span id="our_price_display">{convertPrice price=$productPrice}</span>
   <!--{if $tax_enabled  && ((isset($display_tax_label) && $display_tax_label == 1) OR !isset($display_tax_label))}
	{if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
   {/if}-->
 {/if}
 </p>

 {if $product->on_sale}
  <img src="{$img_dir}onsale_{$lang_iso}.gif" alt="{l s='On sale'}" class="on_sale_img"/>
  <span class="on_sale">{l s='On sale!'}</span>
 {elseif $product->specificPrice AND $product->specificPrice.reduction AND $productPriceWithoutRedution > $productPrice}
  <span class="discount">{l s='Reduced price!'}</span>
 {/if}
 {if $priceDisplay == 2}
  <br />
  <span id="pretaxe_price"><span id="pretaxe_price_display">{convertPrice price=$product->getPrice(false, $smarty.const.NULL)}</span> {l s='tax excl.'}</span>
 {/if}
</div>
{if $product->specificPrice AND $product->specificPrice.reduction_type == 'percentage'}
 <p id="reduction_percent"><span id="reduction_percent_display">-{$product->specificPrice.reduction*100}%</span></p>
{/if}

{if $product->specificPrice AND $product->specificPrice.reduction}
 <p id="old_price"><span class="bold">
 {if $priceDisplay >= 0 && $priceDisplay <= 2}
  {if $productPriceWithoutRedution > $productPrice}
   <span id="old_price_display">{convertPrice price=$productPriceWithoutRedution}</span>
	<!-- {if $tax_enabled && $display_tax_label == 1}
	 {if $priceDisplay == 1}{l s='tax excl.'}{else}{l s='tax incl.'}{/if}
	{/if} -->
  {/if}
 {/if}
 </span>
 </p>
{/if}
{if $packItems|@count}
 <p class="pack_price">{l s='instead of'} <span style="text-decoration: line-through;">{convertPrice price=$product->getNoPackPrice()}</span></p>
 <br class="clear" />
{/if}
{if $product->ecotax != 0}
 <p class="price-ecotax">{l s='include'} <span id="ecotax_price_display">{if $priceDisplay == 2}{$ecotax_tax_exc|convertAndFormatPrice}{else}{$ecotax_tax_inc|convertAndFormatPrice}{/if}</span> {l s='for green tax'}
  {if $product->specificPrice AND $product->specificPrice.reduction}
  <br />{l s='(not impacted by the discount)'}
  {/if}
 </p>
{/if}
{if !empty($product->unity) && $product->unit_price_ratio > 0.000000}
  {math equation="pprice / punit_price"  pprice=$productPrice  punit_price=$product->unit_price_ratio assign=unit_price}
 <p class="unit-price"><span id="unit_price_display">{convertPrice price=$unit_price}</span> {l s='per'} {$product->unity|escape:'htmlall':'UTF-8'}</p>
{/if}
{*close if for show price*}
{/if}

/////////////////////////////////////////////// Here is the customizable products code I moved into



<!-- Customizable products -->
{if $product->customizable}
<ul class="idTabs clearfix">
 <li><a style="cursor: pointer">{l s='Product customization'}</a></li>
</ul>
<div class="customization_block">

<img src="{$img_dir}icon/infos.gif" alt="Informations" />
{l s='After saving your customized product, remember to add it to your cart.'}
{if $product->uploadable_files}<br />{l s='Allowed file formats are: GIF, JPG, PNG'}{/if}
  </p>
  {if $product->uploadable_files|intval}
  <h2>{l s='Pictures'}</h2>
  <ul id="uploadable_files">
{counter start=0 assign='customizationField'}
{foreach from=$customizationFields item='field' name='customizationFields'}
 {if $field.type == 0}
  <li class="customizationUploadLine{if $field.required} required{/if}">{assign var='key' value='pictures_'|cat:$product->id|cat:'_'|cat:$field.id_customization_field}
   {if isset($pictures.$key)}<div class="customizationUploadBrowse">
	 <img src="{$pic_dir}{$pictures.$key}_small" alt="" />
	 <a href="{* $link->getProductDeletePictureLink($product,{$field.id_customization_field})*}" title="{l s='Delete'}" >
	  <img src="{$img_dir}icon/delete.gif" alt="{l s='Delete'}" class="customization_delete_icon" width="11" height="13" />
	 </a>
	</div>{/if}
   <div class="customizationUploadBrowse"><input type="file" name="file{$field.id_customization_field}" id="img{$customizationField}" class="customization_block_input {if isset($pictures.$key)}filled{/if}" />{if $field.required}<sup>*</sup>{/if}
   <div class="customizationUploadBrowseDescription">{if !empty($field.name)}{$field.name}{else}{l s='Please select an image file from your hard drive'}{/if}</div></div>
  </li>
  {counter}
 {/if}
{/foreach}
  </ul>
  {/if}
  <div class="clear"></div>
  {if $product->text_fields|intval}
  <h2>{l s='Texts'}</h2>
  <ul id="text_fields">
{counter start=0 assign='customizationField'}
{foreach from=$customizationFields item='field' name='customizationFields'}
 {if $field.type == 1}
  <li class="customizationUploadLine{if $field.required} required{/if}">{assign var='key' value='textFields_'|cat:$product->id|cat:'_'|cat:$field.id_customization_field}
   {if !empty($field.name)}{$field.name}{/if}{if $field.required}<sup>*</sup>{/if}<textarea type="text" name="textField{$field.id_customization_field}" id="textField{$customizationField}" rows="1" cols="40" class="customization_block_input" />{if isset($textFields.$key)}{$textFields.$key|stripslashes}{/if}</textarea>
  </li>
  {counter}
 {/if}
{/foreach}
  </ul>
  {/if}


 <p class="clear required"><sup>*</sup> {l s='required fields'}</p>
</div>
{/if}

///////////////////////////////////////////////////////////////////////////////////////


<p{if (!$allow_oosp && $product->quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE} style="display: none;"{/if} id="add_to_cart" class="buttons_bottom_block"><span></span><input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" /></p>

{if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if}

<div class="clear"></div>
  </div>


  </form>
  {/if}

 

 

Here is my CartController override and my ajax-cart. However I will say, I don't think I use the ajax calls. When ever you add an item in my shop, it takes you directly to the cart. The ajax method didn't fit my needs. In looking at the ajax-cart, it would probably need to be modified to remove the references to "customizationForm" and replace with "buy_block".

 

I didn't attach my product.tpl file because it is now heavily customized. While I wanted the flexability of having text fields on my form, I still wanted the values they could be to be database driven. This now happens with a jquery popup and custom tables much like ps_attribute, ps_product_attribute and ps_product_attribute_combination.

 

 

The CartController.php file is placed in override\controllers

The whole blockcart module has been copied over to my theme\modules folder

 

If you are trying to debug, I highly recommend the combination of eclipse/xdebug and FireFox. Without them, I wouldn't have been able to figure out what was or wasn't really working.

Share this post


Link to post
Share on other sites

Also. Can you give us your website link if possible? Then we can see your wonderful work.

 

Here is my CartController override and my ajax-cart. However I will say, I don't think I use the ajax calls. When ever you add an item in my shop, it takes you directly to the cart. The ajax method didn't fit my needs. In looking at the ajax-cart, it would probably need to be modified to remove the references to "customizationForm" and replace with "buy_block".

 

I didn't attach my product.tpl file because it is now heavily customized. While I wanted the flexability of having text fields on my form, I still wanted the values they could be to be database driven. This now happens with a jquery popup and custom tables much like ps_attribute, ps_product_attribute and ps_product_attribute_combination.

 

 

The CartController.php file is placed in override\controllers

The whole blockcart module has been copied over to my theme\modules folder

 

If you are trying to debug, I highly recommend the combination of eclipse/xdebug and FireFox. Without them, I wouldn't have been able to figure out what was or wasn't really working.

Share this post


Link to post
Share on other sites

There should be a hidden input field, submitcustomizeddatas, that needs to be moved to the buy_block as well. I didn't see it in your example. Look for it in the bottom of your product.tpl file. One my site is online, I'll post a link. Right now I'm testing on my local machine.

Share this post


Link to post
Share on other sites

There should be a hidden input field, submitcustomizeddatas, that needs to be moved to the buy_block as well. I didn't see it in your example. Look for it in the bottom of your product.tpl file. One my site is online, I'll post a link. Right now I'm testing on my local machine.

Thanks a lot. It worked.

Share this post


Link to post
Share on other sites

Thank you! drifter, work fine your code ^_^

 

Hi. is it possible for you to post your code for the files that you changed. I have been trying for the past 3 days to get this working but I am failing. Please if you can also include the product.tpl and the other files that you modified.

 

Thank you in advance

Share this post


Link to post
Share on other sites

quinnsoft, you asked for the link to my site once it was up and running. Here it is http://www.lovablestitches.com

 

You can see how I use a blend of PrestaShop's combinations and custom tables/jquery to give it addtional functinoality.

Share this post


Link to post
Share on other sites

Has anybody been able to use this with a single click Add to Cart that isn't located in the product.tpl file? I need to create one and would like to also pass a customize text field with it. Sounds like this thread is as close as anyone has ever gotten.

Share this post


Link to post
Share on other sites