Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- $(function() {
- $("#cartform").validate({
- rules: {
- "order_products::quantity[]": {
- required: true,
- min: 1
- }
- },
- errorPlacement: function($label, $element) {
- $("<tr />").append(
- $("<td />").attr({colspan: 2}).html($label.css({ margin: 0}))
- ).insertAfter($element.closest("tr"));
- },
- submitHandler: function(form) {
- $form = $(form);
- var product_id = $form.find("input[name='order_products::product_id[]']").val();
- if (product_id) {
- var values = $.map($form.find("select[name='order_product_values::value_id[]']"), >function(elem) { return elem.value; });
- var quantity = >$form.find("input[name='order_products::quantity[]']").val();
- $.cart(product_id, values, quantity);
- $(".cart_count").html($.cart().length);
- //when the item was successfully added to the cart, the user is >redirected to their shopping cart summary
- window.location.href("order.php");
- }
- return false;
- }
- });
- });
- </script>
- function writeCookie() {
- var crumbs = [];
- for (var i in cart) {
- crumbs.push(
- '{"product_id":' + cart[i].product_id + ',"quantity":' + >cart[i].quantity + ',"values":[' + cart[i].values.toString() + ']}'
- );
- }
- $.cookie('omani_cart', "[" + crumbs.join(",") + "]", { expires: 7, >domain: location.hostname , path:'/'}); // setCookie('omani_cart',"[" + >crumbs.join(",") + "]","/",location.hostname,false,true);*/
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement