A A A

Please consider registering
guest

Log In Register

Login form protected by Login LockDown.


Register | Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

    

Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
How to add an extra option box to Market 4.0
January 25, 2012
9:39 pm
sewgeen
Member
Forum Posts: 10
Member Since:
January 23, 2012
Offline
21

Hmm, thats why we went with market theme because above you said you can have unlimited options above.  But let me ask you this, is there a way for us to get the variables that do not cost extra, and then also somehow have 7 variables max per product that charge extra, and those are the ones that get submitted to paypal?  meaning the options with no affect on the charge of the item never go to paypal?

January 25, 2012
11:42 pm
New Hampshire
Member
Forum Posts: 144
Member Since:
August 3, 2011
Offline
22

I don't think so.  That seems to be a paypal IPN gateway limit regardless if the options have the added charge on them or not.  Worth a try I guess.

StitchTek Services, LLC is the parent company for the following websites http://www.jaquilting.com (Market Theme Site) http://www.chriscolotti.us
January 26, 2012
2:42 am
Admin
Forum Posts: 5753
Member Since:
March 16, 2008
Offline
23

No, probably not.

If I mentioned "unlimited options" somewhere, that's my mistake, and I'll edit the post to change that.  I looked above however, but don't see that comment anywhere.

January 27, 2012
4:20 pm
sewgeen
Member
Forum Posts: 10
Member Since:
January 23, 2012
Offline
24

Sorry about that, the comment about unlimited was in an email from you.  I can send it if you wish.

 

But another shot in the dark: do you know off the top of your head if any of the newer payment modules in 4.3 will allow this many options?  Specifically Authorize.net.

 

Thanks!

January 30, 2012
10:40 pm
Admin
Forum Posts: 5753
Member Since:
March 16, 2008
Offline
25

I believe with Authorize.net there are no option limitations like there are with Paypal.

February 3, 2012
7:17 am
sewgeen
Member
Forum Posts: 10
Member Since:
January 23, 2012
Offline
26

thanks will test tomorrow and let everyone know if it works.

March 21, 2012
10:33 am
Simon Swallow
Member
Forum Posts: 4
Member Since:
December 30, 2011
Offline
27

Hi

 

I would like to rename the "size" Product Details box to "personalise"

 

Is this just a case of following the above code guide and swapping out personalise for size ??

 

I would also like to allow user to enter a finite no of characters after choosing to personalise the product – maybe use the special instructions box ??

 

http://longcottage.co.uk/wp/?p=65   for site build area

March 22, 2012
10:28 pm
Admin
Forum Posts: 5753
Member Since:
March 16, 2008
Offline
28

If you would simply like to change the option labels, just edit the text in the "English.php" file.  You can edit it through the "Appearance" menu tab of the Wordpress administration area.

For limiting the number of characters, you can add some restriction code to the "textarea" special instructions box like what is described here:

http://www.mediacollege.com/in…..cters.html

The code for the special instructions box is located in the "single.php" file around line #306 where it says:

<textarea name="notes" class="field" style="font-size:11px;" wrap="soft"><?php echo $mkt_special_notes; ?></textarea>
May 8, 2012
6:07 pm
sewgeen
Member
Forum Posts: 10
Member Since:
January 23, 2012
Offline
29

we are still having trouble getting the extra options to work on tonyscanvas.com.  I switched over to authorize.net to get around the gateway limit of paypal and still the problem persists.  Please let me know if you can help and what you need from us.

 

Thanks!

May 8, 2012
6:35 pm
Admin
Forum Posts: 5753
Member Since:
March 16, 2008
Offline
30

This is a little outside the scope of included support, since it's a pretty big customization. You may have to utilize the services of an outsourced coder for it.

Sorry I can't provide you with the code.

November 17, 2012
5:08 am
Admin
Forum Posts: 5753
Member Since:
March 16, 2008
Offline

Some of the base code has changed since this thread was first created.  The following is the updated code changes for versions 4.2 and higher.

 

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 in a number increment for each additional option such as "color2", "color3", "color4", etc.  The option name is not important at this point, as you'll enter what you want the website to actually say later on.  For coding purposes, it's easiest to stay with variables built off of "color", for easy understanding and guidance.

 

When making the following changes, be sure to take your time, and make backup copies of the files before you start.  

You will be editing these files:
  single.php
  functions.php
  language/English.php   (or other language file you may be using)

First, open the file "single.php" for editing.

On or around line #13 locate the line:

$color = get_post_meta($post->ID, 'color', $single = true); // check items color

Add this line immediately AFTER:

$color2 = get_post_meta($post->ID, 'color2', $single = true); // extra option 1

 

For MORE options, you need to repeat this line addition, but change the "2" to "3", and then "4", and so forth for each additional option.)

Example:

$color3 = get_post_meta($post->ID, 'color3', $single = true); // extra option 2
$color4 = get_post_meta($post->ID, 'color4', $single = true); // extra option 3
$color5 = get_post_meta($post->ID, 'color5', $single = true); // extra option 4

etc.

 

Next, find the line around line #25 that says this:

$colorlist = explode(",", $color);

Immediately AFTER this line, add this new line:

$colorlist2 = explode(",", $color2);

 

(again, for additional options, repeat this line addition as you did above, but increment the "2" to "3", "4", etc.

Next, find this section of code on or around line#33.

$colorlistdata = explode(",", $color);
for ($i = 0; $i < count($colorlistdata); $i++) {
    $colorlistoptions = explode("@", $colorlistdata[$i]);    
    $colorlist[$i] = $colorlistoptions[0];
    if (isset($colorlistoptions[1])) {$colorlistprice[$i] = $colorlistoptions[1];} else {$colorlistprice[$i] = '';}
}

 

Immediately AFTER this, enter this NEW section of code (incrementing the variables to end in "2")

$colorlistdata2 = explode(",", $color2);
for ($i = 0; $i < count($colorlistdata2); $i++) {
    $colorlistoptions2 = explode("@", $colorlistdata2[$i]);    
    $colorlist2[$i] = $colorlistoptions2[0];
    if (isset($colorlistoptions2[1])) {$colorlistprice2[$i] = $colorlistoptions2[1];} else {$colorlistprice2[$i] = '';}
}

 

(again, just like before for each new option box, you'll need to paste this new section of code, but change the "2" to "3","4", etc.)

Like this:

$colorlistdata3 = explode(",", $color3);
for ($i = 0; $i < count($colorlistdata3); $i++) {
    $colorlistoptions3 = explode("@", $colorlistdata3[$i]);    
    $colorlist3[$i] = $colorlistoptions3[0];
    if (isset($colorlistoptions3[1])) {$colorlistprice3[$i] = $colorlistoptions3[1];} else {$colorlistprice3[$i] = '';}
}

 

Next, find this section of code like this:

        <tr>
           <?php if (!empty($color)){

            echo '<td><input type="hidden" name="on1" value="'.mkt_THEME_SINGLE_LABEL_COLOR.'"/>'.mkt_THEME_SINGLE_LABEL_COLOR.':</td>
                    <td><select id="os1" name="os1" class="field">';
              
               for($i=0; $i<count($colorlist); $i++){
                echo "<option value='$colorlist[$i]'>$colorlist[$i]</option>";
            }         
            
            echo '</select></td>'; 
            } ?>
        </tr>

Immediately AFTER this section, enter this new section of code:

        <tr>
           <?php if (!empty($color2)){

            echo '<td><input type="hidden" name="on2" value="'.mkt_THEME_SINGLE_LABEL_COLOR2.'"/>'.mkt_THEME_SINGLE_LABEL_COLOR2.':</td>
                    <td><select id="os2" name="os2" class="field">';
              
               for($i=0; $i<count($colorlist2); $i++){
                echo "<option value='$colorlist2[$i]'>$colorlist2[$i]</option>";
            }         
            
            echo '</select></td>'; 
            } ?>
        </tr>

 

(You'll see, that you changed the 5 variables "$color", "on1", "os1", "mkt_THEME_SINGLE_LABEL_COLOR", and "$colorlist")

Again, for multiple options beyond one extra, you'll repeat the code addition, and change the "2" to "3", "4", etc.

Next, go down further in the page and locate this section of code:

        <tr>
           <?php if (!empty($color)){

            echo '<td><input type="hidden" name="on1" value="'.mkt_THEME_SINGLE_LABEL_COLOR.'"/>'.mkt_THEME_SINGLE_LABEL_COLOR.':</td>
                    <td><select id="os1" name="os1" class="field">';
              
               for($i=0; $i<count($colorlist); $i++){
                if ($colorlistprice[$i]) {
                    if ($colorlistprice[$i]>0) {
                        $optiontext = " (+".$mkt_currency_symbol; 
                    } else {
                        $optiontext = " (-".$mkt_currency_symbol; 
                    }
                    $optiontext = $optiontext . $CURRENCY_SYMBOL.number_format(abs($colorlistprice[$i]), 2, '.', ','); 
                    $optiontext = $optiontext .")";
                } else {
                    $optiontext = "";
                }
                echo "<option value='$colorlist[$i]@$colorlistprice[$i]'>$colorlist[$i] $optiontext</option>";
            }         
            
            echo '</select></td>'; 
            } ?>
        </tr>

 

Immediately AFTER this section, enter this NEW section of code:

        <tr>
           <?php if (!empty($color2)){

            echo '<td><input type="hidden" name="on2" value="'.mkt_THEME_SINGLE_LABEL_COLOR2.'"/>'.mkt_THEME_SINGLE_LABEL_COLOR2.':</td>
                    <td><select id="os2" name="os2" class="field">';
              
               for($i=0; $i<count($colorlist2); $i++){
                if ($colorlistprice2[$i]) {
                    if ($colorlistprice2[$i]>0) {
                        $optiontext = " (+".$mkt_currency_symbol; 
                    } else {
                        $optiontext = " (-".$mkt_currency_symbol; 
                    }
                    $optiontext = $optiontext . $CURRENCY_SYMBOL.number_format(abs($colorlistprice2[$i]), 2, '.', ','); 
                    $optiontext = $optiontext .")";
                } else {
                    $optiontext = "";
                }
                echo "<option value='$colorlist2[$i]@$colorlistprice2[$i]'>$colorlist2[$i] $optiontext</option>";
            }         
            
            echo '</select></td>'; 
            } ?>
        </tr>

 

Again, like in the previous steps -- you can add another section of code like this, and change the variables ending in "2" to "3" and so forth.

 

SAVE THE FILE.

 

Now…  we need to make changes to the "functions.php" file.  So, open it for editing.

All of the changes will be made after the section titled

// ******************************************************************************** //
// ************************* Product Manager functions **************************** //
// ******************************************************************************** //

on or around line # 2073.

First, go down a little to the section on or around line #2183 where it says:

 

    $color = get_post_meta($post->ID, 'color', $single = true);

Immediately AFTER this line, add the following new line:

 

    $color2 = get_post_meta($post->ID, 'color2', $single = true);

 

Next, on or around line #2391 find this section of code:

       <div class="postbox" id="id_mkt_color_options">
          <h3 style="font-weight: normal;"><?php echo mkt_ADMIN_ADD_PRODUCT_COLORS; ?></h3>
           <div class="inside">
            <table style="text-align: left;">
            <tr>
                <td><input tabindex="1" type="text" name="color" id="color" value="<?php echo htmlentities($color, ENT_QUOTES); ?>"  scrolling="auto" size="30" cols="30" rows="4" tabindex="9"></td><td valign="top" style="font-size: 11px;"><?php echo mkt_ADMIN_ADD_PRODUCT_COLORS_EXAMPLE1; ?><br/><br/><?php echo mkt_ADMIN_ADD_PRODUCT_COLORS_EXAMPLE2; ?></td>
                
                </tr>
                </table>
               </div>
      </div>  

 

Immediately AFTER this section, add this NEW section of code:

       <div class="postbox" id="id_mkt_color_options2">
          <h3 style="font-weight: normal;"><?php echo mkt_ADMIN_ADD_PRODUCT_COLORS2; ?></h3>
           <div class="inside">
            <table style="text-align: left;">
            <tr>
                <td><input tabindex="1" type="text" name="color2" id="color2" value="<?php echo htmlentities($color2, ENT_QUOTES); ?>"  scrolling="auto" size="30" cols="30" rows="4" tabindex="9"></td><td valign="top" style="font-size: 11px;"><?php echo mkt_ADMIN_ADD_PRODUCT_COLORS2_EXAMPLE1; ?><br/><br/><?php echo mkt_ADMIN_ADD_PRODUCT_COLORS2_EXAMPLE2; ?></td>
                
                </tr>
                </table>
               </div>
      </div>   

 

(Again, for multiple new options, add this code again, replacing the variables ending in "2" with "3", "4", etc.  Be careful not to miss anything.)

 

Next, scroll down until you find the line of code that says:

 

    $color = stripslashes($_POST["color"]);

Immediately AFTER this line, enter the following new line:

 

    $color2 = stripslashes($_POST["color2"]);

 

(do the same incremental changes for multiple options as you've been doing.)

 

Next, scroll down and find the line:

 

    delete_post_meta($id, 'color');

Immediately AFTER this line, add this NEW line:

 

    delete_post_meta($id, 'color2');

 

(Same incremental numbers apply for more options.  "3", "4", "5", etc.)

 

Next, scroll down and find the line:

 

    add_post_meta($id, 'color', $color);

Immediately AFTER this, add the new line:

 

    add_post_meta($id, 'color2', $color2);

 

(Same incremental numbers apply for more options.  "3", "4", "5", etc.)

 

SAVE THE FILE.

 

Ok, almost done.  Just a few more changes to the language file, which will control what's displayed on your website.

(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.

Locate the line:

define('mkt_THEME_SINGLE_LABEL_COLOR', 'Color');

Add this immediately after:

define('mkt_THEME_SINGLE_LABEL_COLOR2', 'Extra Option Label');

(Note: you may change the text "Extra Option Label" 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 man say "color2", but 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.)

Again, if you have created additional options, there would be other lines added like this:

define('mkt_THEME_SINGLE_LABEL_COLOR3', 'Extra Option Label');
define('mkt_THEME_SINGLE_LABEL_COLOR4', 'Extra Option Label');
define('mkt_THEME_SINGLE_LABEL_COLOR5', 'Extra Option Label');

 

Next, 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 line 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');

In similar fashion, change "…_COLORS2_" to "3", "4", "5", etc. for multiple options.

(Note:  Again, you can make change the text between the second set of single quotes to say whatever you like.  )

Lastly, locate this 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>');

Immediately AFTER this line, enter this NEW line of code:

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, and make sure to increment the "2" to "3", "4", etc. for multiple new options.  )

SAVE THE FILE.

If you didn't edit things through the built-in Wordpress editor, then make sure to upload these changed files manually via FTP.

I believe that should do it.

Forum Timezone: UTC 0

Most Users Ever Online: 129

Currently Online:
14 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

icy1: 2636

wreed06: 175

laurie390: 169

boutiqueelliette: 154

StitchTek Services, LLC: 144

yiorgos: 127

Member Stats:

Guest Posters: 455

Members: 2434

Moderators: 1

Admins: 1

Forum Stats:

Groups: 1

Forums: 4

Topics: 4011

Posts: 18728

Newest Members: gourmasia, warriortx5, bodie2020, wmgeorge, bjoern.knobloch, cookevillelife

Moderators: Market Admin (5753)

Administrators: Market Admin (5753)

Market takes e-commerce to the next level with an easy to use, quick setup platform. Learn more or take the tour.