Jump to content

Extra Text Field


Recommended Posts

Guest axell66
Posted

Hi Guys

Just a quick question:

Can I add extra fields to the order form. What I need to do is add a field were to visitor can type in a message/name that they what printed on a item.

So it would look some thing like this:

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

Please type in the message you would like to appear of item:

<TEXTBOX>

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

I could not see this feature in the list on the main Cube Cart site (unless I'm being blind)

Many thanks

Axel

  • 11 years later...
Posted

I need the same thing, an additional text field during checkout, where customers can enter text to be printed on the product, cakes in this case.
Ideally, this should be conditional, for certain products only, but if it shows for every product, that's not a big problem either.

Google only found me this very old post. The link above is long gone and was for CC4 anyway.

Is there a way in the current version of CC to do this, or another extension?

Thanks.

Posted

This can be done with current product options capabilities.

When creating product options (before assigning them to products), you can choose option type "Text" or "TextArea".

After assigning this option type to a product, there will be a text field or text area in the options area of the View Product page.

 

Posted (edited)

Update:

One small problem though.

I made a testorder with two dropdown-options and one textfield-option.
Shows up in the basket and during checkout process.

But in the order confirmation I get, there is only the main product and no chosen options at all.

Clicking on the view order link in the mail the options show up again.

So I suppose this has to be done in E-Mail templates, which I have not touched so far.

First thing I find strange ist, that under "Translations" there seem to be two German ones and I have no idea why or which one is used.

However, in both of them I found the placeholder for "{$product.product_options}" which I would have thought gives me all chosen options.
But why not?

template_languages.jpg.5185a43160caf27b4e66a4cc1caaae69.jpg

template_content.jpg.84261e6cefa8bc51e8965ce6fcf173ed.jpg

 

Edited by MostlyConfused
Posted

Please let us know if you are using the shipping module Print Order Form. If so, in admin, Manage Extensions, please let us know if the version being used is v1.2.2 (or 1.3.0 which has a new German translation).

 

Posted

Missing product options being displayed in the email seems to not be caused by the Print Order Form (an earlier version was found to cause a somewhat different problem).

Also, CubeCart sees only one instance of the German language file.

So, we still need to determine why the Email Templates listing shows two instances of the German flag.

Please use an external database utility to examine the database table CubeCart_email_content. Does anything look strange there?

Posted (edited)

Indeed it looks a bit strange, with what seem like duplicate entries.
I am not aware that I did anything to cause this.

Can send you the whole SQL if you like.

db.thumb.png.440443f46aaeef8a1986504429f7e0f4.png

 

Edited by MostlyConfused
Posted

I am wondering if, somehow perhaps a bug in the code, installing de-DE "over" the existing de-DE language pack, didn't actually overwrite the existing databased content of the email-contents with the contents of the new file of that incoming language pack. (Unlike the language phrases that exist in a file in a language pack, the phrases of the email-contents file of the language pack are all databased.)

I will check on that.

In the meantime, you can sort the above listing and delete all rows having 'content_id' equal to or greater than 26.

 

  • Like 1
Posted (edited)

I have deleted those entries 26 and up. Did not change anything so far in the order confirmation, but I did not expect that.

Do you want me to update to Print Order Form 1.3.0 too?
The current output of it is working and shows all options. Just not in the emails.

Cheers

In admin, it looks like it should now:

translations.png.686824ad1bd08f72aae7c0fdb7143fd3.png

Edited by MostlyConfused
Posted

Another update, when I placed my testorders, I only received confirmation mails as a customer and they contain none of the chosen options.

Today I asked my client to forward me her (store owner's) confirmation mails. And there, all options are perfectly shown.

Maybe this helps, to narrow down the problem.

options.png.f7ea79e22d155fa0b304a2f0ff22a4d5.png

 

Posted

The POF module prior to 1.2.2 had its own code to email a courtesy email confirming the order was placed. Version 1.2.2 now is supposed to use the established code in CubeCart's core codebase.

Looking at 1.2.2 (version 1.3.0 is the same), it seems more work needed was mentioned to the programmers, but didn't get done.

So, please make this edit:

In the Print Order Form module, gateway.class.php, near line 206, find:

					if (!empty($item['product_options'])) $product['product_options'] = implode(' ',unserialize($item['product_options']));

Change to:

					if (!empty($item['product_options'])) {
						if (($list = unserialize($item['product_options'])) !== false) {
							foreach ($list as $value) {
								$item['options'][] = $value;
							}
						} else {
							if(method_exists($order,'unSerializeOptions')) {
								$options = $order->unSerializeOptions($item['product_options']);
							} else {
								if(empty($item['product_options'])) {
									$options = array();
								} else if(($options = cc_unserialize($item['product_options'])) !== false) {
								} else if (($options = cc_unserialize(base64_decode($item['product_options']))) !== false) {	
								} else {
									$options = explode("\n", $item['product_options']);
								}
								
							}
							foreach ($options as $option) {
								$value	= trim($option);
								if (empty($value)) continue;
								$item['options'][] = $value;
							}
						}
					}

 

  • Like 1
Posted (edited)

Instead of nothing at all, this gives me now:

Artikel 	Menge 	Preis
Kirchliche Feste 01
YTozOntpOi01OTtzOjE4OiJUb3J0ZW5mYXJiZW46IHJvc2EiO2k6MTMyO3M6MzE6IkJlc2NocmlmdHVuZzogVG9ydHkgTWNUb3J0ZXJzb24iO2k6MTAzO3M6MzY6IlRvcnRlbmF1c3dhaGw6IEpvZ2h1cnQtUGZpcnNpY2h0b3J0ZSI7fQ==

This is still BASE64 encoded.
If I decode the string, it reads:
 

a:3:{i:-59;s:18:"Tortenfarben: rosa";i:132;s:31:"Beschriftung: Torty McTorterson";i:103;s:36:"Tortenauswahl: Joghurt-Pfirsichtorte";}

so it's an array with the correct value in it.
Can't figure out where and what to change though.

Edited by MostlyConfused
Posted

My bad.

Replace that other new code with this new code:

					if (!empty($item['product_options'])) {
						$product['product_options'] = array();
						if (($list = unserialize($item['product_options'])) !== false) {
							foreach ($list as $value) {
								$product['product_options'][] = $value;
							}
						} else {
							if(method_exists($order,'unSerializeOptions')) {
								$options = $order->unSerializeOptions($item['product_options']);
							} else {
								if(empty($item['product_options'])) {
									$options = array();
								} else if(($options = cc_unserialize($item['product_options'])) !== false) {
								} else if (($options = cc_unserialize(base64_decode($item['product_options']))) !== false) {
								} else {
									$options = explode("\n", $item['product_options']);
								}

							}
							foreach ($options as $option) {
								$value	= trim($option);
								if (empty($value)) continue;
								$product['product_options'][] = $value;
							}
						}
						$product['product_options'] = implode("\n", $product['product_options']);
					}

 

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...