Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery('.cart button').on('click', function () {
- var price = jQuery('.price').text();
- var priceValue = parseInt(price.substring(0, price.length - 1));
- var cart = jQuery('#cart');
- var cartValue = parseInt(cart.text().substring(0, cart.text().length - 1));
- cart.text(cartValue + priceValue + '$');
- jQuery.getJSON("http://jsonip.com/?callback=?", function (data) {
- var ip = data.ip.toString();
- jQuery.ajax({
- type: "POST",
- url: "../myupdate.php",
- data: ["ip="+ip, "cart="+jQuery('#cart').text()]
- }).done(function () {
- console.log('done');
- }).error(function () {
- console.log('error');
- });
- });
- <?php
- $ip = $_POST[ip];
- $cart = $_POST[cart];
- db_insert('abweb')
- ->fields(array('ip' => $ip, 'product' => 'some product', 'price' => $cart))
- ->execute();
- function mymodule_commerce_cart_product_add($order, $product, $quantity, $line_item) {
- $commerce_line_item = commerce_line_item_load($line_item->line_item_id);
- $field_main = $product->field_main['und']['0']['value'];
- $line_item->field_update[LANGUAGE_NONE][0]['value'] = $field_main;
- commerce_line_item_save($line_item);
- }
Add Comment
Please, Sign In to add comment