close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Automatically adding a product?

Thread began 10/31/2012 10:56 am by josephman1988418631 | Last modified 11/02/2012 10:51 am by Jason Byrnes | 1144 views | 9 replies |

josephman1988418631

Automatically adding a product?

Hi Guys,

Basically I want to be able to say, once the user has logged in, automatically ad a specific product to the cart, and send them to the final checkout page.

If possible, the best scenario would be when the user 'registers', they have a 'single membership' product added to the cart, then it goes straight to sagepay.

If anyone can help me with either method that would be fantastic.

Regards,
Joe.

Sign in to reply to this post

Jason ByrnesWebAssist

you can use the Add to cart server behavior for this.


the add to cart server behavior can be accessed from the server behaviors panel (Window -> Server Behaviors). click the plus button the select eCart -> Add to Cart.

set the trigger to use the registration button pressed.

after it is added, you will want to make sure the code for the add to cart is added after the code for the Insert record.

Sign in to reply to this post

josephman1988418631

Thanks for pointing me in the right direction.

How do I change the trigger so it activates on the registrationg submit button rather then the one that the 'add to cart' server behaviour adds?

I guess I'm asking how do i 'alter' the trigger?

Sign in to reply to this post

Jason ByrnesWebAssist

The trigger dropdown select list should have options for each of the form buttons on your page.

Select the Registration button pressed option.

Sign in to reply to this post

josephman1988418631

When I click 'add to cart' I'm prompted with the following 3 tabs which I have attached.

I can't control the trigger for this behavior?

Sorry if I'm being stupid!

Sign in to reply to this post

Jason ByrnesWebAssist

This is the Add to cart button behavior, not the add to cart server behavior.


to add the add to cart server behavior, open the server behaviors panel, click the plus button and select eCart -> Add to Cart -> Add to Cart

Sign in to reply to this post

josephman1988418631

The previous screenshot is what opens when I do your instructions:

New attached image shows the process your explaining and the previous shows the window that opens when clicking this.

Fairly confused!

Thanks for your help so far!

Sign in to reply to this post

Jason ByrnesWebAssist

What version of eCart?

The add to cart server behavior was added in eCart 5, if you have a previous version, the trigger will need to be hand coded to accomplish what you are trying to do.

send a copy of the registration page with the add to cart button on it and I can tell you what code to change.

Sign in to reply to this post

josephman1988418631

No wonder it wasn't making sense! It's v4.5.

Note that the attached file, line 96, is one I tried manually, this can be ignored.

Thanks!

Regards,
Joe.

Attached Files
register.zip
Sign in to reply to this post

Jason ByrnesWebAssist

the add to cart button trigger is at line 147:

php:
if (isset($_POST["skincentrics_1_ATC"]) || isset($_POST["skincentrics_1_ATC_x"]))     {



change that to:

php:
if (isset($_POST["KT_Insert1"]) || isset($_POST["KT_Insert1"]))     {



NOTE: you will also need to merge the add to cart form elements into the registration form


change the following code:

php:
<input type="submit" name="KT_Insert1" id="KT_Insert1" value="Register" class="eC_FormButton" style="background-color:#d4a67c;" />

                </div>
                                        
                </form>
<!-- Confirm Form -->
<form name="skincentrics_1_ATC_22" method="POST"  action="<?php echo $_SERVER["PHP_SELF"]; ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".$_SERVER["QUERY_STRING"]:""?>">
  <input type="hidden" name="skincentrics_1_ID_Add" value="22" >
  <input type="text" name="skincentrics_1_Quantity_Add" value="1" size="4" >
  <input type="submit" value="Add to Cart" name="skincentrics_1_ATC">
</form>




to:

php:
<input type="submit" name="KT_Insert1" id="KT_Insert1" value="Register" class="eC_FormButton" style="background-color:#d4a67c;" />

                </div>
                                        
                
<!-- Confirm Form -->

  <input type="hidden" name="skincentrics_1_ID_Add" value="22" >
  <input type="text" name="skincentrics_1_Quantity_Add" value="1" size="4" >
  <!--<input type="submit" value="Add to Cart" name="skincentrics_1_ATC">-->
</form>
Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...