Some of you have asked how to add an additional option dropdown box to the Market Theme website and admin area.
Here's how:
Most of the code is still the same for version 4.0, however the Market Product Manager plugin has actually been integrated into the Market theme "functions.php" file, so it's actually a little easier.
I believe there are only a couple of files you'll need to modify with version 4.0 — they are:
single.php
functions.php
language/english.php
In essence — what you're going to do is find all of the option items related to "color", and then copy them and change the variable names and increment some "os" and "on" numbers.
In "single.php", here are the lines you're going to copy and modify:
Next, scroll down until you find this on or around line #1667:
$color = stripslashes($_POST["color"]);
Add this immediately after:
$color2 = stripslashes($_POST["color2"]);
Next, find the line:
delete_post_meta($id, 'color');
Add this immediately after:
delete_post_meta($id, 'color2');
Next, find the line:
add_post_meta($id, 'color', $color);
Add this immediately after:
add_post_meta($id, 'color2', $color2);
Save the file.
Now, the last step is to update the language file. (We'll do this for english, however you'll need to do it for German, italian, etc. if you want to use those languages.)
So, open up the file "english.php" located in the "language/" folder.
(Note: you may change the text "Extra Color" to anything you desire. This is the text that will display on the website to the customer, so name it something meaningful to them, such as "bottom color" or "inside color" or whatever. You can even name it something unrelated to color like "Capacity". The code behind the scenes can say "color2" and it won't matter. Only the text from this language file will be visible to users, so this is where you customize what the extra option box is used for.)
Now, locate the line:
define('mkt_ADMIN_ADD_PRODUCT_COLORS_EXAMPLE1', '<span class="mpm_infoblue">Separate colors with a comma.</span><br />For Example: <b>Red,White,Blue</b>');
Add this immediately after:
define('mkt_ADMIN_ADD_PRODUCT_COLORS2_EXAMPLE1', 'Place any text you desire in here – this is the instructions area for adding the option');
(Note: Again, you can make change the text to say whatever you like. )
Now, locate the line:
define('mkt_ADMIN_ADD_PRODUCT_COLORS_EXAMPLE2', '<span class="mpm_infored">For option upcharge or discount, use a "@" symbol followed by price variance.</span><br />For Example: <b>Red@-1.25,White,Blue@1.50</b>');
Add this immediately after:
define('mkt_ADMIN_ADD_PRODUCT_COLORS2_EXAMPLE2', 'Place any text you desire in here – same applies as above');
(Note: Again, you can make change the text to say whatever you like. )
Save the file, and upload all the files.
I believe that should do it.
10:04 am July 18, 2010
ibfishn
Member
posts 9
2
Can you add 2 additional option boxes?
7:56 pm July 21, 2010
Market Admin
Admin
posts 4756
3
Yes, but you'll need to change variable names. (ie. Everywhere it says "color2", make it say "color3", – Where it says "colorlist2", make it say "colorlist3", etc.)
Also, "os2" will become "os3".
It's basically the same changes, but with different variables.
1:13 pm July 23, 2010
ibfishn
Member
posts 9
4
outstanding!
8:33 am July 30, 2010
senlin
New Member
posts 1
5
tried this, but doesn't work
new custom field shows, but doesn't register once saved
5:17 pm July 30, 2010
Market Admin
Admin
posts 4756
6
You must be missing a copied line somewhere. Just do a search for the word "color", and try to duplicate all of the lines that shows up in, and then name them as a different variable.
10:39 am March 28, 2011
ericab
Member
posts 17
7
Will this work if you are using 4.1?
I did everything you mentioned above but under English.php there was no line that read define('mkt_THEME_SINGLE_LABEL_COLOR2', 'Color');
Now when I add items to the cart, the cart shows blank.
11:59 am March 28, 2011
Market Admin
Admin
posts 4756
8
You'll need to add that line to English.php, as it's a new label that wasn't there before your modification.
If your cart is now showing blank, when it DID show before — then my guess is that you added a single quote somewhere in your editing of "English.php".
Single quotes (and apostrophes), need to be preceeded by a backslash "\" character so that they are not viewed as part of the code.
Like this:
won\'t
Not like this:
won't
2:05 pm March 28, 2011
ericab
Member
posts 17
9
It works now. I didn't add anything incorrectly I guess. It was the mod security issue. Hostgator cleared it all up. Thanks.
8:09 am April 7, 2011
boutiqueelliette
Member
posts 121
10
Can we do this but have a box that the customer can write in instead of choices to pick?
12:42 pm April 7, 2011
Market Admin
Admin
posts 4756
11
Let's continue the "text box" topic on this other thread:
oh, so sorry – I didn't realize I had already asked
7:17 am July 21, 2011
rrsales
Member
posts 4
13
Since this is a pretty useful feature for anyone that runs a shopping cart, why does'nt this theme come with this feature? Instead of giving people directions how to add this custom code to their site why not just make it part of the features? Example
In the settings area give the option to have as many drop down option boxes as one needs. Also why don't you add a way that the options are saved so your customers do not have to copy this same information over and over? I have had to copy the same options over and over for several products. However if this was an option then all I would have to do is choose this same option from a drop down menu. It's a very simple and streight forward theme and cart but you could do much more with it!
4:29 pm July 21, 2011
Market Admin
Admin
posts 4756
14
It's easier said than done.
Market is a continuous work in progress, and is advancing more and more as time goes on.
Thanks for the feedback.
3:05 am January 2, 2012
StitchTek Services, LLC
New Hampshire
Member
posts 141
15
Post edited 3:16 am – January 2, 2012 by StitchTek Services, LLC
I have made all these changes and pages still will not render. I have searched high and low for the issue in the three files and I have not found any issues that I can readily see. :(. Everything looks fine on the edit pages the new fields all show up, but the pages will all not open with a 500 server error now.
The code above does not show the id="" section nor in the copied sectin. Is there additional code that is missing in this document for 4.28 specifically? I am at a total loss after 4 hours.
StitchTek Services, LLC is the parent company for the following websites
I am curious how you increase the size of the text box in the editor? All this appears as though it should be the same as the color field but I would like to extend the box to be longer. When line of code is it?
StitchTek Services, LLC is the parent company for the following websites
Post edited 10:24 pm – January 6, 2012 by Market Admin
To extend the width of the text box, you just increase the value of the "size" value in the "input" tag. (The code is located in the functions.php file.)
Yep that helps. I thought it was that line, but it is set the same as the one above yet they ae different lengths. I will give it a shot but it is working awesome now for us!
StitchTek Services, LLC is the parent company for the following websites
I have taken these steps to add extra options to my site: tonyscanvas.com and once i get past 10 extra options, the rest will not register with the extra money for those options.
It seems it is working on a test product, but on my existing products the extra money will not register in the cart.
Please let me know if Ican paste in my code or email you the three files to see what I am doing wrong. I have rechecked the code on all three files multiple times and I am positive there are no mistakes. I am at a total loss because it worked before and we havent changed anything and now it doesnt work.
Thanks, Tony
12:51 am January 25, 2012
Market Admin
Admin
posts 4756
20
In the Paypal documentation, it looks like there is a maximum limit of 7 options.