AbanteCart Community

AbanteCart Development => Customization help => Topic started by: Christo1045 on October 19, 2017, 02:27:12 AM

Title: Customizing Confirm Page
Post by: Christo1045 on October 19, 2017, 02:27:12 AM
Hi Guys

I've added a dropdown list on the Confirm page at /storefront/view/default/template/pages/checkout/confirm.tlp for the user to select the Sales Rep they usually deal with.

Code:
<div class="col-md-3 well" style="margin-left: 15px">
   <h4>Who do you deal with?</h4>
   <select required>
      <option value="">Choose Sales Rep</option>
      <option value="Rep1">Rep1</option>
      <option value="Rep2">Rep2</option>
      <option value="Rep3">Rep3</option>
      <option value="Rep4">Rep4</option>
   </select>
</div>

Questions:

1.) How to save this with my order, show on my invoice etc?
2.) Which table to add fields to?
3.) Which files to add code to?

I'll look into creating an extension later on as I'm currently restricted with budget and time.

Any help to point me in the right direction would be appreciated.

Thanks

Chris
Title: Re: Customizing Confirm Page
Post by: Basara on October 19, 2017, 07:39:52 AM
Hello.

Check this extension https://marketplace.abantecart.com/order-attributes
Title: Re: Customizing Confirm Page
Post by: Christo1045 on October 19, 2017, 07:53:50 AM
I know about the extension, but prefer not to use it due to budget constraints...

Any other help?
Title: Re: Customizing Confirm Page
Post by: Christo1045 on October 20, 2017, 10:05:23 AM
Okay, so I bought the extension but have an issue. I'm using a select (dropdown) and it's set to required, leaving the first option as empty so the user should make a selection. Any RegEx I try either let's the user proceed or not at all. I need a solution, correct RegEx to not accept blank values. 
Title: Re: Customizing Confirm Page
Post by: maxter on October 20, 2017, 03:05:31 PM
What is the RegEx that you use?
Title: Re: Customizing Confirm Page
Post by: Christo1045 on October 21, 2017, 12:30:22 AM
I tried /.*\S.*/ and a few others, but nothing works. The normal select fields in AbanteCart has a Placeholder attribute that can be set, but not in this extension. I need the user to choose an option and not leave it black, nor use the default.
Title: Re: Customizing Confirm Page
Post by: Christo1045 on November 01, 2017, 07:58:36 AM
No Suggestions yet guys?
Title: Re: Customizing Confirm Page
Post by: Basara on November 01, 2017, 08:45:44 AM
Hello.
There are a lot tools in the internet to create or test regex or even libraries http://www.regexlib.com
Title: Re: Customizing Confirm Page
Post by: Christo1045 on November 01, 2017, 09:00:55 AM
Okay, so this is why this extension does not work 100%.

It allows an Element to be blank, but assigns a value to it, so therefore, your selection will always have a value to it.

<select name="attributes[10]" class="form-control " id="attributes10" data-placeholder="">  <-- Where do I set this in the Extension?
        <option value="101"></option> <-- How can I set this to  "selected disabled"
   <option value="102">Sales Rep 1</option>
   <option value="103">Sales Rep 2</option>
   <option value="104">Sales Rep 3</option>
   <option value="105">Sales Rep 4</option>
   <option value="106">Sales Rep 5</option>
   <option value="107">Sales Rep 6</option>
   <option value="108">Sales Rep 7</option>
   <option value="109">Sales Rep 8</option>
   <option value="110">Sales Rep 9</option>
   <option value="111">Sales Rep 10</option>
   <option value="112">Not applicable</option>
</select>

Regards

Chris
Title: Re: Customizing Confirm Page
Post by: Christo1045 on November 06, 2017, 06:57:43 AM
So I've managed to get this working in a way.

Inspecting the Element (MS Edge), find the value attached to the blank option:

<select name="attributes[10]" class="form-control " id="attributes10" data-placeholder="">
         <option value="111">-- Choose a Rep --</option> <!--- Here we are, value = 111 -->
         <option value="115">Not applicable</option>
         <option value="101">Sales Rep 1</option>
         <option value="102">Sales Rep 2</option>
         <option value="103">Sales Rep 3</option>
         <option value="104">Sales Rep 4</option>
         <option value="105">Sales Rep 5</option>
         <option value="106">Sales Rep 6</option>
         <option value="107">Sales Rep 7</option>
         <option value="108">Sales Rep 8</option>
         <option value="109">Sales Rep 9</option>
         <option value="110">Sales Rep 10</option>
   </select>

Set the RegEx to /^((?!111).)*$/

So you can select any other value except 111.

Hope this helps someone else.

Regards

Chris
Title: Re: Customizing Confirm Page
Post by: Basara on November 06, 2017, 06:59:22 AM
Thank you, Christo1045