WebsiteBaker Support (2.8.x) > Bakery Shop

Bakery Second Address line field

<< < (2/3) > >>

jacobi22:

--- Quote ---I will post here my results Smiley
--- End quote ---

i hope so  ;-)

svsanchez:
For clarification purposes in case other people are interested in this modification, this is to allow a bigger ADDRESS FIELD (not last name field). Simply do what Jacobi22 instructs here but when he mentions last_name you have to apply the changes to the address field (STREET)  :wink:

Ok, I almost did it but I am running into the 2 following problems:

1) Since all fields were converted to small textareas, they have the sizing box option activated, which doesn't look ok and can lead to confusion with customers trying to add more text into the fields. I tried adding box-sizing:none; to the frontend.css but it didn't work. How can I get rid of the box sizing on those fields?

2) My address box now looks nice with the default 3 rows for entering the bigger address for those customers who need it, BUT Bakery won't accept any address if I hit the "ENTER" key. So if I add something like:

BOX 695 [ENTER]
1869 NW 97th Ave

It won't accept the address. I googled for the regex character for the [ENTER] char and couldn't find anything conclusive, so I tried adding \r to the $MOD_BAKERY['ADD_REGEXP_CHARS'] = 'áéíóúñÑ\r';

Unfortunately the \r didn't work so I guess I need something else there.

svsanchez:
Hello, could someone please tell me if it's possible to fix the above mentioned problems, as the solution provided by Jacobi won't work because Bakery won't accept the address when the customer hits the [enter] key.

Thank you

jacobi22:

--- Quote ---1) Since all fields were converted to small textareas, they have the sizing box option activated, which doesn't look ok and can lead to confusion with customers trying to add more text into the fields. I tried adding box-sizing:none; to the frontend.css but it didn't work. How can I get rid of the box sizing on those fields?
--- End quote ---

resize:none is the solution

for my example i use it here in the frontend.css (see the example in the last posting)

--- Code: ---.pcust_email, .pcust_confirm_email, .pcust_first_name, .pcust_last_name, .pcust_zip, .pcust_city {height:16px;resize: none;}
--- End code ---


--- Quote ---Hello, could someone please tell me if it's possible to fix the above mentioned problems, as the solution provided by Jacobi won't work because Bakery won't accept the address when the customer hits the [enter] key.
--- End quote ---

use \s in preg_match, its for whitespaces and include the break or "new row"
example (but it works for me without problems)

view.php // line 498

--- Code: ---if (strpos($field, 'street') !== false) {
                                if (!preg_match('#^[\sA-Za-z0-9'.$add_chars.' +&-]{1,500}$#', $value)) {
                                        $error_bg[] = $field;
                                        $errors[] = htmlspecialchars($value, ENT_QUOTES).' '.$MOD_BAKERY['ERR_INVAL_STREET'];
                                }
                        }
--- End code ---

then go to this code in line 564 ff and change it from
original

--- Code: ---// If all fields correct, write into db
        foreach ($_POST as $field => $value) {
                if ($field != 'summary' && $field != 'cust_confirm_email') {
                        $field = $admin->add_slashes(strip_tags($field));
                        $value = $admin->add_slashes(strip_tags($value));
                        $updates[] = "$field = '$value'";
                }
        }
--- End code ---

to

--- Code: ---// If all fields correct, write into db
        foreach ($_POST as $field => $value) {
                if ($field != 'summary' && $field != 'cust_confirm_email') {
                        $field = $admin->add_slashes(strip_tags($field));
                        $value = $admin->add_slashes(strip_tags($value));
                        $value = nl2br($value);
                        $updates[] = "$field = '$value'";
                }
        }
--- End code ---


then go to view_summary.php at line 185 to this code here

--- Code: ---// Join customer first and last name
$cust_name = $cust_first_name." ".$cust_last_name;


--- End code ---

and change it to

--- Code: ---// Join customer first and last name
$cust_name = $cust_first_name." ".$cust_last_name;
$cust_street = nl2br($cust_street);
--- End code ---

for your special char problem...
maybe it helps, if you use this chars direct in the preg_match-code, like this

view.php // line 498

--- Code: ---if (strpos($field, 'street') !== false) {
                                if (!preg_match('#^[\sA-Za-z0-9'.$add_chars.' áéíóúñÑ+&-]{1,500}$#', $value)) {
                                        $error_bg[] = $field;
                                        $errors[] = htmlspecialchars($value, ENT_QUOTES).' '.$MOD_BAKERY['ERR_INVAL_STREET'];
                                }
                        }
--- End code ---

svsanchez:
Thank you Jacobi! I'm almost finished, the only problem now is that I can add the second line to the customer's address BUT NOT to the SHIPPING address. I tried the following but I only made my shipping address fields disappear:

1) In frontend.css I added the other fields, so now I have:


--- Code: ---.pcust_email, .pcust_confirm_email, .pcust_first_name, .pcust_last_name, .pcust_zip, .pcust_city, .pcust_phone, .pship_first_name, .pship_last_name, .pship_city, .pship_zip {height:16px; resize:none;}

--- End code ---

2) Then in form.htm I changed the ship textfield blocks so it now looks like this:


--- Code: ---<!-- BEGIN ship_textfields_block
<tr id="{TR_ID}">
<td class ="mod_bakery_form_label_f">{LABEL}</td>
<td><textarea type="text" class="{CSS_ERROR_CLASS}mod_bakery_form_input_f p{NAME}" name="{NAME}" value="" maxlength="{MAXLENGHT}">{VALUE}</textarea></td>
</tr>
END cust_textfields_block -->

--- End code ---

I just tried repeating what you told me for the shipping address but it wasn't as easy as I hoped, what did I do wrong?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version