01/09/2006 Note: The technique described in this post is for versions of Squirrelcart 1.6.3 or older. For versions 2.1.3 and newer, please see the instructions in the documentation:
http://www.squirrelcart.com/help/?Ad...0Manually.html
If you are using versions 2.0.0 - 2.1.2, you will need to upgrade to v2.1.3 to get this functionality.
10/01/2005 Note: This technique described in this post does not work for v2.0.0. We will be issuing an updated version to handle this functionality. When we do, this post will be updated.
02/21/2005 Note: This post has been updated to include support for the security fix posted here:
http://www.ldev.com/forums/showthread.php?t=1768
Suppose you already have a site completely designed, including all of the pages necessary to display your products. If you wish, you can use the cart just for the checkout process, and link your already designed product pages to it. This configuration is not recommended, but works fine if you are in this situation. Here is how to do it:
Follow the normal installation instructions, then take a look below:
1. Rename demo.php (store.php in newer versions) to shop.php (or whatever)
2. Make all the required changes to your config.php file, including changing the value of your cart_page variable
3. Log into http://YOURSITE.COM/squirrelcart
4. Click the "store settings" icon
5. Make sure "cart behavior" is set to go to checkout
6. You need to design shop.php so it fits in with the existing design of the cart. If you have a particular navigation scheme, or logo, or whatever, put it on this page. When you add to the cart, the customer will be redirected to this page, so you will want it to look as close to your other pages as possible.
7. Add your products and descriptions into the cart's DB via the admin page - http://YOURSITE.COM/squirrelcart. Even though you already have static html pages designed to display your products, you still need to add them to the database. The cart looks the info up in the DB so it can display the items in the checkout table. Basically, the only information you need to enter in the product records is:
- Name
Price
Thumnbnail Image
Description
You don't have to worry about categories.
8. Write down the "record_numbers" that the cart assigns the products
9. Now...you need to figure out how to get the already designed pages to add the products to the cart. Here is how the form would look:
As long as these form elements are on your page, and the prod_rn field is set to the proper product's record number, the item will be added to the cart, and the customer will be redirected to your cart page (store.php in this example)Code:<form action="http://YOURSITE.COM/store.php?show_cart=1" method="post"> <img src="someproduct.jpg">Buy this great product<br> <b>Quantity: </b><input type="text" name="quantity" size="3" value="1"> <input type="hidden" name="add_to_cart" value="1"> <!--make the below match the product's record_number in the Squirrelcart DB--> <input type="hidden" name="prod_rn" value="173"> <input type="image" src="images/add_to_cart.gif"> </form>
10. By default, when a customer views all the items in the cart at checkout, thumbnail images are shown along with each item. These thumbnails are also links to display the product in the manner the cart would normally display it in. Because you are using your own design to display the items, you probably will want to remove this link altogether, and just display the image. You can do it by modifying the template file "view_cart_item.php". Make sure you read the documentation on the proper way to modify template files. Then see the example below:
You need to find this code:
And change it to:Code:<a href="<?=$Product_Link?>"> <img border="0" src="<?=$Thumbnail_Image ?>"> </a>
11. You will probably also want to add some sort of continue shopping link to get them back to the store itself. You can do this in the template files "view_cart_header.php" OR "view_cart_footer.php". Just add a link like this:Code:<img border="0" src="<?=$Thumbnail_Image ?>">
This link is just like clicking the "back" button on your browser. You may want to change the number 1 to a 2 to go back 2 pages.Code:<a href="javascript:history.go(-1)">Continue Shopping</a>
Edit: 11/20/2004
If you wish to add product options to your pages, you will need to generate code for each option. For a select input, the code would be similar to this:
For a textarea input:Code:Add extra blades: <select name="option[]"> <option value="Extra Blades^^^^----^^----"></option> <option value="Extra Blades^^5 pack^^.99^^1.5">5 pack: $.99</option> <option value="Extra Blades^^70 pack^^15.99^^5.5">70 pack: $15.99</option> </select>
For a text input:Code:<input name='option[]' type='hidden' value='----'> Message for gift card: <br> <textarea style='vertical-align: top; width: 200px; height: 100px' type='text' name='text_option[0]'></textarea> <input type='hidden' name='option_name[0]' value='Gift Card'> <input type='hidden' name='option_price[0]' value='----'> <input type='hidden' name='option_weight[0]' value='----'> <input type='hidden' name='option_type[0]' value='Textarea Input'>
02/21/2005 Edit: You will also need to add the product options to the product's record (or it's category). The options need to match exactly, or Squirrelcart will not add them when adding the product to the cart.Code:<input type="hidden" name="option[]" value="----"> Enter message: <input type="text" style="width: 200" type="text" name="text_option[0]"> <input type="hidden" name="option_name[0]" value="Message"> <input type="hidden" name="option_price[0]" value="----"> <input type="hidden" name="option_weight[0]" value="----"> <input type="hidden" name="option_type[0]" value="Text Input">
08/02/2005 Edit: As of v1.5.3, Squirrelcart checks product options when adding an item to the cart, to ensure that they have not been altered by a customer (i.e, to change the price, etc). The code that does this check will cause any options coded as described above to not add to the cart. To resolve this, you will need to disable the "tamper check". Here is how to do that:
1. Open the file squirrelcart/functions/checkout/add_to_cart.func.php
2. Find this line (around 90 to 100, depending on your version):
Change the line to this:PHP Code:if ($SC['prod_opt_cache'][$prod_rn][$cache_key]) $new_option[] = $option[$r];
PHP Code:if ($SC['prod_opt_cache'][$prod_rn][$cache_key] || true) $new_option[] = $option[$r];


Reply With Quote

