Jump to content

How to remove save button for customized fields?


otzy

Recommended Posts

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/

Link to comment
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 (see edit history)
  • Like 5
Link to comment
Share on other sites

  • 1 month later...
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";
       }

Link to comment
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
Link to comment
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.

Link to comment
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.
Link to comment
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
Link to comment
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
Link to comment
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)
Link to comment
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

Link to comment
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
Link to comment
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
Link to comment
Share on other sites

  • 3 months later...
  • 3 weeks later...
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
Link to comment
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!

Link to comment
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)

Link to comment
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?

Link to comment
Share on other sites

  • 3 weeks later...

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!

Link to comment
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.
Link to comment
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);
           }
       });

Link to comment
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)

Link to comment
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

Link to comment
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!

Link to comment
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.

Link to comment
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!

Link to comment
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
Link to comment
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.

Link to comment
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.

Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...

¿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

Link to comment
Share on other sites

  • 5 weeks later...

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

Link to comment
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

Link to comment
Share on other sites

  • 2 weeks later...

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!

Link to comment
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

Link to comment
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?

Link to comment
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

Link to comment
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.

Link to comment
Share on other sites

  • 1 month later...

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.

Link to comment
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
Link to comment
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.

Link to comment
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.

Link to comment
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.

Link to comment
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.

Link to comment
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

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 2 weeks later...
  • 2 months later...
  • 1 month later...

Hi, there is someone who has been able to operate correctly in prestashop 1.4?, Please if anyone can share the changes you need to do to work properly, it would be a great help. I tried all ways and means, and does not even work with ajax enabled or without activating the ajax does not work anything, can you help ?, My version is 1.4 thanks prestashop.

 

Hola, existe alguien que lo haya podido hacer funcionar correctamente en prestashop 1.4 ?, por favor si alguien puede compartir las modificaciones que hay que hacer para que funcione correctamente, sería una gran ayuda. He intentado de todas las formas y maneras, y no funciona ni con ajax activado o sin activar el ajax, no me funciona nada, pueden ayudarme ?, mi version de prestashop es 1.4 gracias.

Link to comment
Share on other sites

Thankyou drifter... your code in post #81 worked great for me on 1.4.8.2. I don't use the Ajax cart on this site so I only needed the CartController.php dropped into override/controllers/.

 

Anyway, as that worked so well I thought I'd see if I could extend it to work for image upload fields as well as text fields. And it was surprisingly straightforward. Job done - no more "Save" button for customisations!

 

Here's how I did it. NB I only use the non-AJAX cart on this site; if you use the AJAX cart there's probably more that needs to be done to get it working, but perhaps this will nudge you in the right direction...

  1. Pull a copy of the pictureUpload() function out of ProductController.php (same place that textRecord() came from), add it to drifter's CartController.php in your /override/controllers directory, and modify it in the same way that textRecord() had been modified from its original version - ie: remove the second parameter from the function prototype, replace $cart with self::$cart , replace $this->product with $product. [There were some other changes in drifter's code, notably replacing some (int) casts with intval(), and using the global $errors[] instead of $this->errors[] - I didn't understand the reasoning for these, and the rest of CartController seems to use the former constructs, so I left them unchanged. Errors, such as uploading an invalid file type, still get reported back to the browser just fine. ]
  2. Add require_once('images.inc.php'); near the top of the file; this provides the checkImage() function needed by pictureUpload().
  3. Add a call to pictureUpload() just before the call to textRecord(). (I suspect before/after doesn't matter, but for consistency I stuck to the same order that ProductController calls them).
  4. Sort your form out. Make sure your product.tpl (or whatever is generating the product page) only creates one <form> instead of two. The <form> tag must have enctype="multipart/form-data" in order to upload files, and include the hidden fields that Presta generates alongside customisation fields, such as submitCustomizedDatas. And, of course, delete the horrid Save button forever! :D

Now, there is one disadvantage to doing it this way... you get no whirly clock to keep the user entertained during the upload by presenting an (entirely fictional) impression of Something Happening. If a user uploads a humongous file as part of a general form submission, the browser will appear to do nothing. Notwithstanding my considered opinion that it's about time browsers did something about this instead of leaving us poor web devs to have to cover for the browser's lack of useful feedback all the time, at some point I'll probably try to integrate a decent AJAX file-uploader with progress bar....

 

In the meantime, here's my version of the CartController.php override.

CartController.php

Link to comment
Share on other sites

  • 1 month later...

Hi Pro's,

 

I am also looking for someone to get this to work on my shop 1.4.7, will pay for someone to fix it by paypal.

Got ftp and admin account setup for the job, anybody? PM me!

 

thx,

Thomas

Link to comment
Share on other sites

just to let all people know, I am on prestashop 1.4.7.0 and I had this issue that when I pressed the save button all attributes got reset to the default combination.

 

And now for the solution...

 

TADAAAAAA: Dont press the save button! Just add to cart, it works without any modification.

 

Then go into css and just hide the button, or remove it from your product.tpl

 

 

and yes, I did (happily) pay someone to find this out for me.

 

greetings,

T

Edited by TWRB (see edit history)
Link to comment
Share on other sites

  • 2 months later...

I tried playing with this on 1.4.9.0 with no success. Just to be sure it wasn't my customized theme, I used the stock Prestashop theme.

 

I've attached the files used (ProductController.php in override/controller, ajax-cart.js in modules/blockcart and product.tpl in the prestashop theme directory) in the zip file below. It works normal if there are no customized fields. It displays the following when I have a customization filed that has a required input:

There is 1 error :

  1. Please fill in all required fields, then save the customization.

Does anyone have any tips to make this work on 1.4.9.0

remove-save-button.zip

Edited by Rhapsody (see edit history)
Link to comment
Share on other sites

Oops - see my edit below

 

A follow-up to my post #99 above. It works on 1.4.9.0 if I don't check "required field" in the BO for text fields in the customization tab for a product. So what needs to be done is figure out where the logic is that checks for required text field input, and move it to the appropriate section in the code.

 

If anyone has an idea, please post here. Once I get this working, I'll post all the files to share with others.

 

Edit: Darn.. it isn't working. I had a cached screen in my browser.

Edited by Rhapsody (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...