Jump to content

raptor30506090

Members
  • Posts

    156
  • Joined

  • Last visited

Everything posted by raptor30506090

  1. Hi im very new at jquery so any info would be great What im trying to do is when a page is loaded i would like to refresh that page once more with jquery
  2. hi guys this seems to be a good one i thnik the problem is here <?php $_SESSION['cart'][] = array(array('id' => $id, 'colour' => $colour, 'size' => $size, 'quantity' => $quantity)); ?> how do i show a session with out the square brackets at the end of $_SESSION['cart']
  3. :'( May be not solved i can put 3 items in the cart all works great then the four one it gos wrong doing my head in here is the new code <?php if(isset($_POST['submit'])){ $id = $_POST['id']; $sleeve = $_POST['sleeve']; $colour = $_POST['colour']; $size = $_POST['size']; $action = $_POST['action']; $quantity = 1; } //IF NOT IN CART if(!isset($_SESSION['cart'])){ $_SESSION['cart'] = array(array('id' => $id, 'colour' => $colour, 'size' => $size, 'quantity' => $quantity)); }else{ foreach($_SESSION['cart'] as $key => $value){ //IF IT IS IN THE CART IM CHECKING TO SEE IF SAME if($value['id'] == $id && $value['colour'] == $colour && $value['size'] == $size){ // ADDING ONE TO THE CART IF SAME $quantity = $value['quantity']+=1; $_SESSION['cart'] = array(array('id' => $id, 'colour' => $colour, 'size' => $size, 'quantity' => $quantity)); }else{ // IF NOT THE SAME PUTTING THIS OUT $_SESSION['cart'] []= array(array('id' => $id, 'colour' => $colour, 'size' => $size, 'quantity' => $quantity)); } } } foreach($_SESSION['cart'] as $cart => $value){ foreach($value as $c => $v){ echo $v; } } ?> Any help work be ace
  4. Thank for your help i have now worked it out all working great
  5. Na sorry still the same as before cant see any diffrence must admit been posting this for some time with out any luck cheers for any help :-\
  6. ok then how do i go about fixing it i can only see it once like this $_SESSION['cart'][$productId][] = array('quantity' =
  7. Im making a shopping cart so my question is $query = mysql_query("SELECT * FROM colour WHERE colour_id=".$colourID); $query = mysql_query("SELECT * FROM products WHERE id=".$id); can i make a jion so i select the product and then make a join to SELECT the colour
  8. Hi guys new at this when the slide comes to the last image how do i make it go back to the first one cheers <div id="holder"> <div id="box"> <div class="1"><img src="test_image/1.jpg" width="520" height="248"></div> <div class="2"><img src="test_image/2.gif" width="520" height="248"></div> <div class="3"><img src="test_image/3.jpg" width="520" height="248"></div> <div class="4"><img src="test_image/4.jpg" width="520" height="248"></div> <div class="5"><img src="test_image/5.gif" width="520" height="248"></div> </div> <span><button id="left">«</button><button id="right">»</button></span> <div id="clear"></div> </div> <script type="text/javascript"> $("#left").click(function(){ $("#box").stop().animate({"left": "+=520px"}, "slow"); }); $("#right").click(function(){ $("#box").animate({"left": "-=520px"}, "slow"); }); </script>
  9. Still could do with some help question if im doing it so wrong can any one point me in the write root. what im trying to do is make a cart say t-shirt and have options for it like colour what they can select then if they choose same t-shirt but diffrent colour it add new product and dont over write last one any help would be great have been trying to do this for some time :'(
  10. No i didnt write this code it was given me from here
  11. This is the help i already have been given this is with comment thanks <?php if(isset($_POST['submit'])){ $productId = $_POST['productId']; $quantity = $_POST['quantity']; $size = $_POST['size']; $color = $_POST['color']; $price = $_POST['price']; //if the productID doesn't exist, just create it: if ( !isset($_SESSION['cart'][$productId]) ) { $_SESSION['cart'][$productId] = array(array('quantity' => $quantity, 'size' => $size, 'color' => $color, 'price' => $price)); } //product already exists, check to see if it's the same as another in the group: foreach ( $_SESSION['cart'][$productId] as &$product ) { //NOTE: If you want to override pricing with new tiers, you can remove 'price' from this comparison. You may also want to // fetch prices from the database when you DISPLAY the cart if you do bulk discounts if ( $product['price'] == $price && $product['color'] == $color && $product['size'] == $size ) { $product['quantity'] += $quantity; } } //if we've reached here, the productID is already in the cart but the current item is not a duplicate of an existing one: $_SESSION['cart'][$productId][] = array('quantity' => $quantity, 'size' => $size, 'color' => $color, 'price' => $price); foreach($_SESSION['cart'][$productId] as $prod => $value){ echo $value['size'] .' '.$value['price']; } //print_r($_SESSION['cart']); } ?>
  12. Or you could loop it <?php $team0 = 1; $team1 = 2; $team2 = 3; $teams = array(array('TeamA' => $team0, 'TeamB' => $team1, 'TeamC' => $team2)); sort($teams); foreach($teams as $team){ while(list($key, $list) = each($team)) { echo 'Team Results: ' . ' ' .$key . ' Points: ' .$list . '<br>'; }} ?>
  13. What about this would this help? <?php $team0 = 1; $team1 = 2; $team2 = 3; $teams = array(array('teamA' => $team0, 'teamB' => $team1, 'teamC' => $team2)); sort($teams); while(list($key, $list) = each($teams)) { echo ' TeamA '.$list['teamA'] . ' TeamB '.$list['teamB'] . ' TeamC '.$list['teamC'] ; } ?> or am i on the wrong track
  14. Hi guys this is code for a t-shirt cart im working on but i keep getting two results from it when i first add a product after that seems to be ok? <?php if(isset($_POST['submit'])){ $productId = $_POST['id']; $quantity = $_POST['quantity']; $size = $_POST['size']; $colour = $_POST['colour']; $design = $_POST['design']; if(!isset($_SESSION['cart'][$productId])){ $_SESSION['cart'][$productId] = array(array('quantity' => $quantity, 'size' => $size, 'colour' => $colour, 'design' => $design)); } foreach ( $_SESSION['cart'][$productId] as &$product ) { if($product['design'] == $design && $product['colour'] == $colour && $product['size'] == $size ) { $product['quantity'] += $quantity; } } $_SESSION['cart'][$productId][] = array('quantity' => $quantity, 'size' => $size, 'colour' => $colour, 'design' => $design); foreach($_SESSION['cart'][$productId] as $prod => $value){ echo $value['size'] .' '.$value['design']; }}?>
  15. Im really sorry about me being a gimp i can access arrays but the session bit as me read thats al iv been doing i now i need lot more practice but im trying thanks for your reply do i use a for or foreach loop? like i say sorry and thanks for your help
  16. Hi guys how do i get the content from this <?php $_SESSION['cart'][$productId][] = array('quantity' => $quantity, 'size' => $size, 'color' => $color, 'price' => $price); ?>
  17. Thank you for that im going to have a go now. cheers
  18. So i now im a pain I had a look at what you said and still couldnt work it out as you can tell im new at carts what im trying to do is in the products have options with price changes but when i do this it over rights the last one in the session with same id so if you order same type of shed say 10x10 at $500 then they what same type again but 10x20 at $750 i would like a new product in the cart but i keep over righting last session Many thanks Daz
  19. Guy im still stuck what im trying to do is 1: create a shopping cart option and session['cart'] 2: options like a shed cost ?500 size 10x10 then adds an option to have the front made in bars and then also orders the same with out the option of bars it has the same id so in my session it over rights can any one tell me the right way to go about it or spell it out to me. Cheers
  20. Hi guys how would i get this in to a session <?php $products = array(array( 'Code' => 'TIR', 'Description' => 'Tires', 'Price' => 10, 'Name' => 'Darren' ), ); for($row = 0; $row < 1; $row++){ while(list($key, $value) = each($products[$row])){ echo $value; } } ?>
  21. thank you for your time ill go and have a play see what i can do Cheers
  22. Sorry ManiacDan if you looked at what i put iv changed the last 3 colour , price and size would this create a new product listing so we would have two products in the cart?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.