Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How can I create an "Add to cart" button? Rate Topic   - - - - -

 
  • argentice
  • Senior Member
  • Members
  • Join Date: 11-May 07
  • 383 posts

Posted 01 June 2007 - 09:02 AM #1

How can I create an "Add to cart" link on a completely separate external page?

What would be the URL for a particular product?
Rob

 
  • SWS
  • Senior Member
  • Members
  • Join Date: 30-Oct 06
  • 798 posts

Posted 01 June 2007 - 11:04 AM #2

Hi Argentice..

It can be done, I stumbled across it by accident. Not the best way I admit but it did work, I also got the cart showing on an external page, but couldnt get it to intially display the products in the cart until I added one

Not that it was my intentions to use it..

Depending on how you want to lay it out whether its static content or not etc etc etc, view source of a page containing the product in question

Copy the code from the add to cart button.

 
<table  cellpadding="0" cellspacing="0" border="0" onclick="javascript: if (fn_check_exceptions(1782)) { document.featuredproductform_1782.target.value='cart'; fn_http_request('ca', fn_form_get_request('featuredproductform_1782') + 'ajax=cart_status'); } else alert(cannot_buy);" class="hand" onmouseover="window.status='Add to cart'; return true;" onmouseout="window.status=''">
<tr>
 <td>
  <img src="/skins/default_blue/customer/images/action_but_left.gif" style="width: 5px; height: 18px; border: 0px; " alt="" /></td>
 <td style="background-image: url('/skins/default_blue/customer/images/action_but_bg.gif');" class="action_button" align="center" nowrap="nowrap">
    Add to cart  </td>
  <td style="background-image: url('/skins/default_blue/customer/images/action_but_bg.gif');" class="action_button">
  <img src="/skins/default_blue/customer/images/action_but_arrow.gif" width="16" height="5" border="0" alt="" /></td>
  <td>
  <img src="/skins/default_blue/customer/images/action_but_right.gif" width="5" height="18" border="0" alt="" /></td>
</tr>
</table>
 

You will also need to ensure that the following is included in your external page

<script type="text/javascript" language="javascript 1.2">
<!--
var index_script = 'index.php';
var image_index = 'image.php';
var target_name = 'target';
var mode_name = 'mode';
var action_name = 'action';
var cannot_buy = 'You cannot buy the product with these option variants ';
var no_products_selected = 'No products selected';
var error_required_fields = 'You did not complete all of the required fields or input data is incorrect.';
var sec_curr_coef = '1.000';
var error_no_items_selected = 'No items selected! At least one checkbox must be ticked off to perform this action.';
var text_delete_confirmation = 'Are you sure you want to delete the selected items?';
var primary_decimals_separator = '.';
var primary_thousands_separator = ',';
var secondary_decimals_separator = '.';
var secondary_thousands_separator = ',';
var lang_out_of_stock = 'Out of stock';
var lang_items = 'items';
var text_required_group_product = 'Please select a product for the required group [group_name]';
-->
</script>
<script type="text/javascript" language="javascript 1.2" src="/skins/default_blue/customer/scripts/form_scripts.js"></script>
 
<body onload="fn_load_handlers();">

As far as I can remember, thats all there was to it, I cant say for sure if its going to work as it was a few weeks back...
[SIZE=3][/SIZE]

 
  • argentice
  • Senior Member
  • Members
  • Join Date: 11-May 07
  • 383 posts

Posted 01 June 2007 - 02:16 PM #3

LOL, I was hoping it was going to be a simple link with a qty and product_id embedded..

But thanks very much, I shall take a look! :)
Rob

 
  • SWS
  • Senior Member
  • Members
  • Join Date: 30-Oct 06
  • 798 posts

Posted 01 June 2007 - 04:43 PM #4

Well it kind of is...

The 2nd lot of code is required otherwise you get undefined errors
The first lot, is just a link to be honest, but using CS's version of a button wrapped in a load of tables ;-)
[SIZE=3][/SIZE]

 

Posted 29 January 2008 - 06:05 PM #5

SWS, That's good info, just curious, if you're building a site that only references the store just for checking out and adding to cart, is this an acceptable way to do this. More specifically, will it carry over all of the data with it if the code you supplied is added page to page instead just on that one page? Or is that more advanced than what you were showing us.

Thanks in advance for any help, I replied here because it seems relevant to me with this post.

 
  • abender
  • Junior Member
  • Members
  • Join Date: 24-Aug 07
  • 9 posts

Posted 13 June 2008 - 05:43 PM #6

I would like to add a "checkout" button and a "view cart" button next to the "add to cart" button for all of my product. I don't want my customers to have to search for the checkout button.

http://safeplug.com/...s&category_id=2

Any help with how I could add these buttons?

Thank you in advance for the help,

:)

Adam

 
  • ricoche
  • Junior Member
  • Members
  • Join Date: 27-Aug 07
  • 17 posts

Posted 05 September 2008 - 02:03 PM #7

LOL, I was hoping it was going to be a simple link with a qty and product_id embedded..

But thanks very much, I shall take a look! :)


I'm looking for an add to cart link without the use of javascript. I need a simple link like mydomain.com/cart/index.php?mode=add&qty=1&product_id=5423 for example.

Would anyone happen to know how this is handled without javascript? Thanks!
------------------------
Using CS-Cart 1.3.5-SP3

 

Posted 05 September 2008 - 03:05 PM #8

Also if you go to your admin site and click on Look and Feel > Site Map here you will see a list of links or just one link maybe, regardless if you click edit links beside the link that is showing you can see the other links to the shopping cart, view cart etc.

Just looking through the thread and checking to make sure you got an answer, I just use
"index.php?target=cart"
for the view cart and
index.php?target=checkout
for checkout. I made buttons or text links for them wherever I needed them.

I would like to add a "checkout" button and a "view cart" button next to the "add to cart" button for all of my product. I don't want my customers to have to search for the checkout button.

http://safeplug.com/...s&category_id=2

Any help with how I could add these buttons?

Thank you in advance for the help,

:)

Adam


Rigging.com V4.x.x - 100% API generated store | SEO & Google Fu Approved

 
  • ricoche
  • Junior Member
  • Members
  • Join Date: 27-Aug 07
  • 17 posts

Posted 05 September 2008 - 04:11 PM #9

Awesome!! Thank you very much. Works perfectly. That pretty much solves the final problem with my mobile site. Thanks!

Jim
------------------------
Using CS-Cart 1.3.5-SP3