Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Chenge the "sold out" button position

Chenge the "sold out" button position

Views: 2,038

Results 1 to 19 of 19
12 Apr 2011, 3:12 PM
#1
ilmarchez avatar

ilmarchez

Zen Follower

Join Date:
Aug 2009
Posts:
128
Plugin Contributions:
0

Chenge the "sold out" button position

Hi,

I'd like to make a minor change on my template.
Actually the "sold out" button for a product is showed below the description, below the price.

You can see the button here (first product, the button "ESAURITO"):
http://tinyurl.com/5rtzhg2

I'd like to move the sold out button immediately below the product title, before the description. I attach a picture of how I'd like it to appear.

Which files should I modify and how?

Thank you for your support.
Ste

12 Apr 2011, 9:46 PM
#2
celtic avatar

celtic

Zen Follower

Join Date:
Feb 2010
Posts:
154
Plugin Contributions:
0

Re: Chenge the "sold out" button position

Looks like your theme has customised the layout for your products listing, so you'll have to look in your theme files and make the changes within the code. The buttons aren't within css tags to allow you to move them around.

Possibly you need to look in one or both of these files...

/includes/templates/theme210/common/tpl_tabular_display.php
/includes/modules/theme210/product_listing.php

12 Apr 2011, 9:54 PM
#3
ilmarchez avatar

ilmarchez

Zen Follower

Join Date:
Aug 2009
Posts:
128
Plugin Contributions:
0

Re: Chenge the "sold out" button position

Celtic:

Looks like your theme has customised the layout for your products listing, so you'll have to look in your theme files and make the changes within the code. The buttons aren't within css tags to allow you to move them around.

Possibly you need to look in one or both of these files...

/includes/templates/theme210/common/tpl_tabular_display.php
/includes/modules/theme210/product_listing.php

thanks for your reply. unfortunately I found only the first file you specified but could you tell me which tag should I look for?

If you'd like to help me I have zipped the folder of the theme at this address: http://dl.dropbox.com/u/267552/theme210.zip

Thank you very much for your help

12 Apr 2011, 10:31 PM
#4
celtic avatar

celtic

Zen Follower

Join Date:
Feb 2010
Posts:
154
Plugin Contributions:
0

Re: Chenge the "sold out" button position

Looking around I see you probably have the 'Column Layout / Grid Layout for Products Listing (Add On Module for Zen Cart v1.3.8)' installed.

If that is the case, then it's likely to be the second line I mention above that needs editing. If you look somewhere around line 189, you may find a line like...

        $lc_text .= '<br />' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);

You need to move that line up to somewhere around line 143, where you may see something like...

        case 'PRODUCT_LIST_NAME':
        $lc_align = '';
        if (isset($_GET['manufacturers_id'])) {
          $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>' ;
        } else {
          $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';
        }
        break;

The line you're moving needs to be put between the } and the break; line.

12 Apr 2011, 10:48 PM
#5
ilmarchez avatar

ilmarchez

Zen Follower

Join Date:
Aug 2009
Posts:
128
Plugin Contributions:
0

Re: Chenge the "sold out" button position

Celtic:

Looking around I see you probably have the 'Column Layout / Grid Layout for Products Listing (Add On Module for Zen Cart v1.3.8)' installed.

If that is the case, then it's likely to be the second line I mention above that needs editing. If you look somewhere around line 189, you may find a line like...

    $lc_text .= '<br />' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);
> 
> ```php
        case 'PRODUCT_LIST_NAME':
        $lc_align = '';
        if (isset($_GET['manufacturers_id'])) {
          $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>' ;
        } else {
          $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';
        }
        break;

The line you're moving needs to be put between the } and the break; line.

Tried it doesn't change at all...

12 Apr 2011, 11:01 PM
#6
celtic avatar

celtic

Zen Follower

Join Date:
Feb 2010
Posts:
154
Plugin Contributions:
0

Re: Chenge the "sold out" button position

What was the path of the file that you edited? Can you send me a copy of the edited file and I'll take a look at it tomorrow.

12 Apr 2011, 11:03 PM
#7
ilmarchez avatar

ilmarchez

Zen Follower

Join Date:
Aug 2009
Posts:
128
Plugin Contributions:
0

Re: Chenge the "sold out" button position

Celtic:

What was the path of the file that you edited? Can you send me a copy of the edited file and I'll take a look at it tomorrow.

Thanks the path is includes/modules/theme210/product_listing.php

You can download the edited file at this address: http://dl.dropbox.com/u/267552/product_listing.php

Thank you for your great support

13 Apr 2011, 8:36 PM
#8
ilmarchez avatar

ilmarchez

Zen Follower

Join Date:
Aug 2009
Posts:
128
Plugin Contributions:
0

Re: Chenge the "sold out" button position

Celtic:

What was the path of the file that you edited? Can you send me a copy of the edited file and I'll take a look at it tomorrow.

Hi do you have any news/idea to fix it?
Thank you

13 Apr 2011, 8:52 PM
#9
celtic avatar

celtic

Zen Follower

Join Date:
Feb 2010
Posts:
154
Plugin Contributions:
0

Re: Chenge the "sold out" button position

I hadn't looked too closely at the previous $lc_text code, so hadn't noticed that the title and the description were combined in one line. The following should fix it...

Replace all of this bit...

        case 'PRODUCT_LIST_NAME':
        $lc_align = '';
        if (isset($_GET['manufacturers_id'])) {
          $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>' ;
        } else {
          $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';
        }
		$lc_text .= '<br />' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);
        break;

... with this bit ...

        case 'PRODUCT_LIST_NAME':
        $lc_align = '';
        $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3>';
				$lc_text .= '<br />' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);
        $lc_text .= '<div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>' ;
        break;

You can see that the line you moved after my previous post is now sitting in between the title and the description, which should give you what you want (assuming this is the correct file to be editing).

13 Apr 2011, 8:58 PM
#10
ilmarchez avatar

ilmarchez

Zen Follower

Join Date:
Aug 2009
Posts:
128
Plugin Contributions:
0

Re: Chenge the "sold out" button position

Celtic:

I hadn't looked too closely at the previous $lc_text code, so hadn't noticed that the title and the description were combined in one line. The following should fix it...

Replace all of this bit...

    case 'PRODUCT_LIST_NAME':
    $lc_align = '';
    if (isset($_GET['manufacturers_id'])) {
      $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>' ;
    } else {
      $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';
    }
    $lc_text .= '<br />' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);
    break;
> 
> ... with this bit ...
> 
> 
> ```php
        case 'PRODUCT_LIST_NAME':
        $lc_align = '';
        $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3>';
                $lc_text .= '<br />' . zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);
        $lc_text .= '<div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>' ;
        break;

You can see that the line you moved after my previous post is now sitting in between the title and the description, which should give you what you want (assuming this is the correct file to be editing).

GREAT! Now it works perfectly, thank you very much for your kind help!
Thanks

13 Apr 2011, 9:16 PM
#11
celtic avatar

celtic

Zen Follower

Join Date:
Feb 2010
Posts:
154
Plugin Contributions:
0

Re: Chenge the "sold out" button position

Nice one. As to your other query...

SECOND: At the page contact us I'd like to make the customer to insert the email address twice and the system to check that both addresses are the same to proceed. i saw here is a module for the registration process but not for the contact us page.

There's two approaches to take to address this...

  1. We could just add a second email box on the contact us page and add a little bit of javascript to check that both email addresses match (plus a edit or two to the language file). No need to store the second email address as it's only a check and should be identical to the first one, so no database changes necessary.

  2. This is unnecessary for what you need to do, but the alternative is more of a full addon module which stores the second email in the database, puts a second entry box on the contact-us page, etc. etc. Bit of an overkill in my opinion.

After the successful changes you've just made to the php code above, I could guide you through option 1 if it helps.

13 Apr 2011, 9:21 PM
#12
ilmarchez avatar

ilmarchez

Zen Follower

Join Date:
Aug 2009
Posts:
128
Plugin Contributions:
0

Re: Chenge the "sold out" button position

Celtic:

Nice one. As to your other query...

SECOND: At the page contact us I'd like to make the customer to insert the email address twice and the system to check that both addresses are the same to proceed. i saw here is a module for the registration process but not for the contact us page.

There's two approaches to take to address this...

  1. We could just add a second email box on the contact us page and add a little bit of javascript to check that both email addresses match (plus a edit or two to the language file). No need to store the second email address as it's only a check and should be identical to the first one, so no database changes necessary.

  2. This is unnecessary for what you need to do, but the alternative is more of a full addon module which stores the second email in the database, puts a second entry box on the contact-us page, etc. etc. Bit of an overkill in my opinion.

After the successful changes you've just made to the php code above, I could guide you through option 1 if it helps.

Thank you very much. I'd definetely do the first option, a javascript checking that bot addresses are the same and then let the page ging on as usual.

I tried to do it by myself, but I really don't know how and where to move, could you please give me instruction as for the sold out button issue?

Thank you so much, and of course I'll keep in mind the bristol writers group! :cool:
Thank you again

13 Apr 2011, 10:11 PM
#13
celtic avatar

celtic

Zen Follower

Join Date:
Feb 2010
Posts:
154
Plugin Contributions:
0

Re: Chenge the "sold out" button position

First of all we need to get ourselves set up properly with the zencart Overrides system. The 'overrides' system of zencart just means that zc will first look for a file in your own template directory, and if it finds the file, it will use that one instead of the default 'core' one. It is very good practice in zencart to always copy default ('core') files into your template directory before you make changes to them. This means your changes won't get wiped out if you upgrade zencart.

So, that said, there are two files that we are interested in for the Contact Us page. The 'core' versions of these files should be found here...

/includes/templates/template_default/templates/tpl_contact_us_default.php
/includes/modules/pages/contact_us/header_php.php

The first file is the actual Contact Us page (and is in the templates folder because it just deals with the look and layout of the page), while the header file deals with the submission of the form data (and therefore is a module that does some processing work).

So, as you are using the template named 'theme210', you need to first check that the above two files exist in the proper 'overrides' folder for your template, which would be...

/includes/templates/theme210/templates/tpl_contact_us_default.php
/includes/modules/theme210/pages/contact_us/header_php.php

If the files don't exist in the 'override' location, just create the appropriate folders then copy the files from their 'core' location into their 'override' location.

Let me know if you have any trouble. I'll get back to it tomorrow hopefully.

14 Apr 2011, 3:34 PM
#14
ilmarchez avatar

ilmarchez

Zen Follower

Join Date:
Aug 2009
Posts:
128
Plugin Contributions:
0

Re: Chenge the "sold out" button position

i have prepared the files and folders, I'm ready....

Thank you

14 Apr 2011, 7:12 PM
#15
celtic avatar

celtic

Zen Follower

Join Date:
Feb 2010
Posts:
154
Plugin Contributions:
0

Re: Chenge the "sold out" button position

Ok, first thing is to get the second email address on the Contact Us page. As the page display is handled in the template we need to edit the template file...

/includes/templates/theme210/templates/tpl_contact_us_default.php

In there, about line 68, you will see the following bit of html...

<label class="inputLabel" for="email-address"><?php echo ENTRY_EMAIL; ?></label>
<?php echo zen_draw_input_field('email', ($error ? $_POST['email'] : $email), ' size="40" id="email-address"') . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?>
<br class="clearBoth" />

Copy those three lines and paste them just below it so that you get a second copy of the email entry code.

Now it's simply a job of adding '2' to all the field names used, making it look like this...

<!-- CELTIC - 14-APR-2011 - added second email field -->
<label class="inputLabel" for="email-address2"><?php echo ENTRY_EMAIL; ?></label>
<?php echo zen_draw_input_field('email2', ($error ? $_POST['email2'] : $email), ' size="40" id="email-address2"') . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . 're-enter email</span>'; ?>
<br class="clearBoth" />
<!-- CELTIC - end of second email field -->

In the edited code above, you'll see that I've done a few things:

  1. I've put an html comment before and after the bit of code that I've added. This is good practice and makes it easy for you to find it again in future and to know why you made the changes in the first place. Just change 'CELTIC' to something that you will use consistently to mark your changes and you'll always know what to search for in future.

  2. I've put the number '2' after all the email field identifiers to ensure zencart doesn't get confused trying to post the email address twice.

  3. I added a little bit of ENGLISH text into the quotes just after ENTRY_REQUIRED_SYMBOL to indicate why there are two email fields. This is a rather clumsy solution but it gets the job done. You will of course have to put your own Italian instruction in there. Not a problem at the moment, but if you were to offer your website in more than 1 language, you would have to do this a bit differently.

Save that and test it and you should have a second email box on the page. When you try and submit it (leave the name field empty) you'll see that it remembers what you put into the second email address field. It also confirms that zencart is using your 'override' copy of the file instead of the 'core' one; if the second box doesn't appear it's probably 'cos we have the override file in the wrong place.

That's all that needs doing in that file.

14 Apr 2011, 9:59 PM
#16
ilmarchez avatar

ilmarchez

Zen Follower

Join Date:
Aug 2009
Posts:
128
Plugin Contributions:
0

Re: Chenge the "sold out" button position

Celtic:

Ok, first thing is to get the second email address on the Contact Us page. As the page display is handled in the template we need to edit the template file...

/includes/templates/theme210/templates/tpl_contact_us_default.php

In there, about line 68, you will see the following bit of html...

<label class="inputLabel" for="email-address"><?php echo ENTRY_EMAIL; ?></label>

<?php echo zen_draw_input_field('email', ($error ? $_POST['email'] : $email), ' size="40" id="email-address"') . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?> <br class="clearBoth" /> ```Copy those three lines and paste them just below it so that you get a second copy of the email entry code. > > Now it's simply a job of adding '2' to all the field names used, making it look like this... > > > ```html <!-- CELTIC - 14-APR-2011 - added second email field --> <label class="inputLabel" for="email-address2"><?php echo ENTRY_EMAIL; ?></label> <?php echo zen_draw_input_field('email2', ($error ? $_POST['email2'] : $email), ' size="40" id="email-address2"') . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . 're-enter email</span>'; ?> <br class="clearBoth" /> <!-- CELTIC - end of second email field --> ```In the edited code above, you'll see that I've done a few things: > > 1. I've put an html comment before and after the bit of code that I've added. This is good practice and makes it easy for you to find it again in future and to know why you made the changes in the first place. Just change 'CELTIC' to something that you will use consistently to mark your changes and you'll always know what to search for in future. > > 2. I've put the number '2' after all the email field identifiers to ensure zencart doesn't get confused trying to post the email address twice. > > 3. I added a little bit of ENGLISH text into the quotes just after ENTRY_REQUIRED_SYMBOL to indicate why there are two email fields. This is a rather clumsy solution but it gets the job done. You will of course have to put your own Italian instruction in there. Not a problem at the moment, but if you were to offer your website in more than 1 language, you would have to do this a bit differently. > > Save that and test it and you should have a second email box on the page. When you try and submit it (leave the name field empty) you'll see that it remembers what you put into the second email address field. It also confirms that zencart is using your 'override' copy of the file instead of the 'core' one; if the second box doesn't appear it's probably 'cos we have the override file in the wrong place. > > That's all that needs doing in that file.

Ok perfect done all and it works. Now we have the second email field. We need to set the rule to check that the two addresses are the same before sending...

thank you again

14 Apr 2011, 11:16 PM
#17
celtic avatar

celtic

Zen Follower

Join Date:
Feb 2010
Posts:
154
Plugin Contributions:
0

Re: Chenge the "sold out" button position

To get the verification to work, we need to edit the module file at...

/includes/modules/theme210/pages/contact_us/header_php.php

Looking at the coding by the zencart team in this file, it's going to be much easier just to add a bit of php code rather than force some javascript into the template page we edited above. So, find this line around line 19...

  $zc_validate_email = zen_validate_email($email_address);

and change it to this...

	// CELTIC - 14-APR-2011 - check first and second email addresses match
  $email_address2 = zen_db_prepare_input($_POST['email2']);
  $zc_validate_email = false;

  if ($email_address == $email_address2) {
	  $zc_validate_email = zen_validate_email($email_address);
	}
	// CELTIC end check for email match

In the above bit of code we...

  1. Add in some comment lines so we know what we changed. In php code, line comments are //

  2. I made a copy of the original email line (on about line 16 in the file) and added the '2's in there to get the values that we set in the template file.

  3. I have forced $zc_validate_email to be false, meaning email validation will always fail.

  4. I have added an 'if' check to see if the original email and our second email address are equal. If they are, we then pass the email address off for its usual validation. If the email given in $email_address is valid, then $zc_validate_email will be set to 'true' so the rest of the contact us form will process as normal.

You may also want to change the error message displayed when then email fails its validation. If you look further down in the file about line 78, you'll see the check for when $zc_validate_email == false displays the text. It uses the variable named ENTRY_EMAIL_ADDRESS_CHECK_ERROR. Just use the Developers Toolkit in your ZenCart admin to search for that CONSTANT name and find out which file you need to change the error text within.

You should now have both your original requests sorted. Well done.

14 Apr 2011, 11:55 PM
#18
ilmarchez avatar

ilmarchez

Zen Follower

Join Date:
Aug 2009
Posts:
128
Plugin Contributions:
0

Re: Chenge the "sold out" button position

Celtic:

To get the verification to work, we need to edit the module file at...

/includes/modules/theme210/pages/contact_us/header_php.php

Looking at the coding by the zencart team in this file, it's going to be much easier just to add a bit of php code rather than force some javascript into the template page we edited above. So, find this line around line 19...

$zc_validate_email = zen_validate_email($email_address);

> 
> 
> ```php
    // CELTIC - 14-APR-2011 - check first and second email addresses match
  $email_address2 = zen_db_prepare_input($_POST['email2']);
  $zc_validate_email = false;

  if ($email_address == $email_address2) {
      $zc_validate_email = zen_validate_email($email_address);
    }
    // CELTIC end check for email match
```In the above bit of code we...
> 
> 1. Add in some comment lines so we know what we changed. In php code, line comments are //
> 
> 2. I made a copy of the original email line (on about line 16 in the file) and added the '2's in there to get the values that we set in the template file.
> 
> 3. I have forced $zc_validate_email to be false, meaning email validation will always fail.
> 
> 4. I have added an 'if' check to see if the original email and our second email address are equal. If they are, we then pass the email address off for its usual validation. If the email given in $email_address is valid, then $zc_validate_email will be set to 'true' so the rest of the contact us form will process as normal.
> 
> 
> You may also want to change the error message displayed when then email fails its validation. If you look further down in the file about line 78, you'll see the check for when $zc_validate_email == false displays the text.  It uses the variable named ENTRY_EMAIL_ADDRESS_CHECK_ERROR.  Just use the Developers Toolkit in your ZenCart admin to search for that CONSTANT name and find out which file you need to change the error text within.
> 
> You should now have both your original requests sorted. Well done.

P-E-R-F-E-C-T! It works perfectly! the only thing I had to modify was to made these changes to includes/modules/pages/contact_us instead of includes/modules/theme210/contact_us/ since in the theme210 folder it didn't work...
Anyway now it works!

Thank you so much! And bristol writers got their donation of course!

Thanks again!
15 Apr 2011, 9:52 PM
#19
celtic avatar

celtic

Zen Follower

Join Date:
Feb 2010
Posts:
154
Plugin Contributions:
0

Re: Chenge the "sold out" button position

Ah, sorry about that, I just checked the overrides documentation again, and it says...

Note: The override system does not yet extend to files in the subfolders order_total, pages, payment, or shipping.

Glad it all worked out for you though, and I know BWG will be very grateful. Good luck with the store - if you were close I'd probably be ordering spares for my 'copter from you.