Jump to content

Search the Community

Showing results for tags 'shopping cart'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 9 results

  1. Hello, I have developed a website pponlinestore.com. I need an urgent help with couple of things. The website is made in Joomla and I have installed hikashop (business edition) for shopping cart. 1) In the above mentioned website, while the checkout process, we accept the customer's address. On the address input form, there is another section for complimentary address. At present it is in one single column. But I want to put it in two columns, but I don't know how to do it. i.e. I want the second column to start from "Complimentary Address". 2) On the "Cart" module on the right, when user clicks on the cancel button of X icon, it directly cancels the order. I want to add another radio button there to add the same product back in case any user have accidently clicked on cancel icon. The purpose is to add flexibility to the site for the user so that he shouldn't go through beginning and he can immediately add the same product back from the same location. I hope I have mentioned my queries / requirements properly. Any help would be much appreciated. Thanks in Advance, Gaurav Kakade
  2. I have a php shopping cart that I am editing that someone else developed. My php skills are still very beginner. Currently the customer must order $500 to place an order if their cart contains less they get a message - order must be $500. They want this to change so that any items that are in the categories of (accessories, scarves and jewelry) ONLY have a min order total of $150 but ALL other items in the other categories STILL have a min order total of $500. So in summary I need it to check if there are any items in accessories, scarves and jewelry - the total of those items OLY needs to be $150 if not a message needs to be displayed "boutique items have $150 min order." Then I need it to check all other items in the cart and those items ONLY need to total $500 or a message needs to be displayed "$500 min order required". There is a lot of other code mixed in with the current orderDetails page about coupons, etc which is throwing me off a little. I have attached a copy of orderDetails page so you could have all the code. I have also attached a screenshot of the cart page since it is unavailble for viewing unless you have a login. Thanks for the help. I need to get this fixed ASAP...I have gotten close a few times but just can not get it exact. orderDetails.php
  3. I'm writing some classes right now for a website with a shopping cart. There are all kinds of classes, Blog, Cart, Product, Database, etc. I am trying to make a design choice about where to store the requested quantity for a particular product. I feel like it should NOT go into the Product class, because the requested quantity does not semantically relate to any of the standard product detail. I was considering maybe setting the quantity property of the product instance, to the requested quantity, once it is put into the cart. For some reason my instinct says no, that it should be abstracted out, perhaps into the Cart class. If that is the case, how do you couple the requested quantity with the requested object? As array key/value pair? Is there another class it could go into? Does anyone have practical experience to shed some light on this?
  4. Hello, first off, I don't have a lot of programming experience. I am working off a YouTube tutorial... I am working with a simple PHP/MYSQL shopping cart that only supports one category and a Paypal checkout/add to cart button. My index.php page successfully shows the items that are in the database with the products() function. I have another function that shows the carts contents, cart(). That successfully displays the carts contents, if available. What I am trying to do is create another function cart_qty() to break apart the contents of cart() to see how many items there are. I would like to display, "You have 1 item" or "...2 items", ect. Any thoughts or helpful direction would be awesome! index.php <?php require 'cart.php'; ?> <!DOCTYPE html> <head> </head> <body> <div class="container"><!-- start container --> <div class="sixteen columns"> <h1 class="remove-bottom" style="margin-top: 40px">Test Shpping Cart </h1> <hr /> </div> <div id="products" class="two-thirds column"> <h1>Products In Our Store</h1> <?php echo products(); ?> </div> <div id="shoppingcart" class="one-third column"> <h3>Your Cart</h3> <?php echo cart(); ?> <br> <br> <br> <?php echo cart_qty(); ?> </div> </div><!-- end container --> </body> </html> cart.php <?php // Start the session session_start(); //session_destroy(); //error_reporting(0); $page = 'index.php'; mysql_connect('localhost', 'root', '') or die(mysql_error()); mysql_select_db('cart') or die(mysql_error()); // add item to cart if (isset($_GET['add'])) { $quantity = mysql_query('SELECT id, quantity FROM tblProducts WHERE id=' . mysql_real_escape_string((int)$_GET['add'])); //prevents SQL injections while($quantity_row = mysql_fetch_assoc($quantity)) { if($quantity_row['quantity'] != $_SESSION['cart_' . (int)$_GET['add']]) { $_SESSION['cart_' . (int)$_GET['add']] += '1'; } } header('Location: ' . $page); } // remove one item from cart if (isset($_GET['remove'])) { $_SESSION['cart_' . (int)$_GET['remove']] --; header('Location: ' . $page); } // delete item item from cart if (isset($_GET['delete'])) { $_SESSION['cart_' . (int)$_GET['delete']] = '0'; header('Location: ' . $page); } // display list of products function products() { $get = mysql_query('SELECT id, name, description, price, shipping FROM tblProducts WHERE quantity > 0 ORDER BY id ASC'); if (mysql_num_rows($get) ==0) { echo 'There are no products to display!'; } else { while($get_row = mysql_fetch_assoc($get)) { echo '<p>' . $get_row['name'] . '<br>' . $get_row['description'] . '<br>' . number_format($get_row['price'], 2) . '<br>' . $get_row['shipping'] . '<br><a href="cart.php?add=' . $get_row['id'] . '">Add</a></p>'; } } } //generate inputs required by PayPal function paypal_items() { $num = 0; foreach($_SESSION as $name => $value) { if($value != 0) { if(substr($name, 0, 5) == 'cart_') { $id = substr($name, 5, strlen($name)-5); $get = mysql_query('SELECT id, name, price, shipping FROM tblProducts WHERE id=' . mysql_real_escape_string((int)$id)); //prevents SQL injections while($get_row = mysql_fetch_assoc($get)) { $num++; echo '<input type="hidden" name="item_number_' . $num . '" value="' . $id . '">'; echo '<input type="hidden" name="item_name_' . $num . '" value="' . $get_row['name'] . '">'; echo '<input type="hidden" name="amount_' . $num . '" value="' . $get_row['price'] . '">'; echo '<input type="hidden" name="shipping_' . $num . '" value="' . $get_row['shipping'] . '">'; echo '<input type="hidden" name="shipping2_' . $num . '" value="' . $get_row['shipping'] . '">'; echo '<input type="hidden" name="quantity_' . $num . '" value="' . $value . '">'; } } } } } //display how many items are in the cart function cart() { foreach($_SESSION as $name => $value) { if($value>0) { if(substr($name, 0, 5) == 'cart_') { //get exact number after "'cart_'$id" $id = substr($name, 5, (strlen($name)-5)); //echo $id; $get = mysql_query('SELECT id, name, price FROM tblProducts WHERE id=' . mysql_real_escape_string((int)$id)); //prevents SQL injections while($get_row = mysql_fetch_assoc($get)) { $sub = $get_row['price'] * $value; echo $get_row['name'] . ' x ' . $value . ' @ $' . number_format($get_row['price'], 2) . ' = $' . number_format($sub, 2) . '<a href="cart.php?remove=' . $id .'">-</a> <a href="cart.php?add=' . $id .'">+</a> <a href="cart.php?delete=' . $id .'">delete</a><br>'; } } $total += number_format($sub, 2); } } if ($total == 0) { echo "Your cart is empty."; } else { echo 'Total: $' . number_format($total, 2) . ''; ?> <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="upload" value="1"> <input type="hidden" name="business" value="someone@yahoo.com"> <?php paypal_items(); ?> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHosted"> <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form> <?php } } function cart_qty() { ///how many items are in cart } ?>
  5. Hey guys, I was wondering what shopping carts do you guys use, and why? I have setup a couple including: Magento, Zencart, OpenCart, and even setup a shopping cart with wordpress. Each one that I have setup have a learning curve except for Wordpress, (if you know how to work with WP). I'd like to know what you guys use, and their usability, which would you recommend, and which is the least to recommend. Thanks. Edit: I Probably should have posted this under PHP Applications.. Can any admin change it? Thanks.
  6. I made this simple shopping cart where you select quantity from a dropwdown list and these numbers get added and you get a total number for all the products and a total number for the product itself. But i want it write the quantity with price and the name and write it in a div placed on the site so that it is easy for the user to see that he added a product. I made the calculating part by adding the products one by one, as i did not array them. But for this next part i just didn't find a way that suited my needs. This is just from my test page , so i only have a few values , but in the other page i have over 70 listed just like these: <div id="radioAlert"> <script type="text/javascript"> //calculator function updatesum() { document.form.sum.value = (document.form.sum0.value -0) *99 + (document.form.sum1.value -0) *99 + (document.form.sum2.value -0) *99; document.form.smu.value = (document.form.prod0.value -0)*99 + (document.form.prod1.value -0) *99 + (document.form.prod2.value -0) *99 + (document.form.prod3.value -0) *99 + (document.form.prod4.value -0) *99; document.form.totalsum.value = (document.form.sum.value -0) + (document.form.smu.value -0); //not a typo i was just lazy with the name //arrays //This one i did not get to work. var myArray = newArray(); myArray[0]=document.form.sum2.value; myArray[1]=document.form.prod0.value; myArray[2]=document.form.prod1.value; myArray[3]=document.form.prod2.value; myArray[4]=document.form.prod3.value; myArray[5]=document.form.prod4.value; for (var i = 0; i < myArray.length; i++) { alert(myArray[i]); } //this part works but i want it to add its value only once and then replace its value if its updated again, if its 0 i want it to be completely removed. var prod1 = document.form.sum2.value; var prod2 = document.form.sum1.value; var radioAlert = document.getElementById("radioAlert"); var radioAlert2 = document.getElementById("radioAlert"); if (document.form.sum2.value>0) { //document.write("pilotjakke pelsforet small " + prod1 + " stk"); radioAlert.innerHTML += ("pilotjakke pelsforet small " + prod1 + " stk"); alert("pilotjakke pelsforet medium " + prod1 + " stk"); } if (document.form.sum1.value>0) { //document.write("pilotjakke pelsforet small " + prod1 + " stk"); radioAlert2.innerHTML += ("pilotjakke pelsforet medium " + prod2 + " stk"); } } </script> </div>
  7. Hello, I'm sorry if I'm not posting this in the correct section; I appologize if I'm not. I'm new to this whole PHP thing, and I am currently building an e-commerce website based on Adam Khoury's video tutorial series on youtube. I'm at a wall here with what I'm trying to do. I've got a drop-box next to the images (products) so that customers can choose which size they will need (the prices will change as well). In the shopping cart page I've got a table with the "Product", "Product Description", "Unit Price", "Quantity", "Total Price" and "Remove" each in their perspective columns. When a customer chooses from the drop-down, I would like that then to send a dollar value to the "Unit Price" column of the cart page and I would also like it to list the size/type of print in the "Product Description" box. I'm not sure how to get it to generate two values like that, or if it's even possible. But here's what I have for code for the product selection page: <form action="cart.php" method="post"> <select name="prints"> <option value="">Select a print size</option> <option value="175.00" name="11x14 Canvas Wrap - $175.00" id="175" >11x14 Canvas Wrap - $175.00 </option> <option value="250.00" name="16x20 Canvas Wrap - $250.00" id="250" >16x20 Canvas Wrap - $250.00 </option> <option value="280.00" name="20x30 Canvas Wrap - $280.00" id="280" >20x30 Canvas Wrap - $280.00 </option> <option value="325.00" name="30x40 Canvas Wrap - $325.00" id="325" >30x40 Canvas Wrap - $325.00 </option> <option value="20.00" name="4x6 Print - $20.00" id="20" >4x6 Print - $20.00 </option> <option value="30.00" name="5x7 Print - $30.00" id="30" >5x7 Print - $30.00 </option> <option value="50.00" name="8x10 Print - $50.00" id="50" >8x10 Print - $50.00 </option> <option value="75.00" name="11x14 Print - $75.00" id="75" >11x14 Print - $75.00 </option> <option value="100.00" name="16x20 Print - $100.00" id="100" >16x20 Print - $100.00 </option> <option value="125.00" name="16x24 Print - $125.00" id="125" >16x24 Print - $125.00 </option> <option value="150.00" name="20x30 Print - $150.00" id="150" >20x30 Print - $150.00 </option> <option value="175.00" name="24x36 Print - $175.00" id="176" >24x36 Print - $175.00 </option> <option value="200.00" name="30x40 Print - $200.00" id="200" >30x40 Print - $200.00 </option> <option value="250.00" name="40x50 Print - $250.00" id="251" >40x50 Print - $250.00 </option> <option value="300.00" name="40x60 Print - $300.00" id="300" >40x60 Print - $300.00 </option> <input type="hidden" name="pid" id="pid" value="<?php echo $id; ?>" /> <input type="submit" name="button" id="button" value="Add Selected to Shopping Cart" /></form><br /> I know I will need to add another value in order to get it to generate another value on the "cart.php" page, but I'm just not sure how. My cart.php is an absolute mess which I will have to clean up as well. (PHP boggles my mind). Here's what the code looks like to re-generate the information into that table I was telling you about: <p><?php ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Section 4 (if user wants to remove an item from cart) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (isset($_POST['index_to_remove']) && $_POST['index_to_remove'] != "") { // Access the array and run code to remove that array index $key_to_remove = $_POST['index_to_remove']; if (count($_SESSION["cart_array"]) <= 1) { unset($_SESSION["cart_array"]); } else { unset($_SESSION["cart_array"]["$key_to_remove"]); sort($_SESSION["cart_array"]); } } ?> <?php ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Section 5 (render the cart for the user to view on the page) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $cartOutput = ""; $cartTotal = ""; $pp_checkout_btn = ''; $product_id_array = ''; if (!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"]) < 1) { $cartOutput = "<h2 align='center'>Your shopping cart is empty</h2>"; } else { // Start PayPal Checkout Button $pp_checkout_btn .= '<form action="[url="https://www.paypal.com/cgi-bin/webscr"]https://www.paypal.com/cgi-bin/webscr[/url]" method="post"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="upload" value="1"> <input type="hidden" name="business" value="
  8. Trying to create a shopping cart that allows user to select not only the product, but the condition of the item (poor condition, good condition, excellent condition), and additional accessories based on the form data submitted. Basically, I'd like to use the same ID for a product with different conditions and accessories. Just not sure how to get there. Any help, advice, or resources is much appreciated! Thank you. Here is the form data I'm collecting from the user: // Phone Type $field_Phone = $_POST['field_Phone'] = $_SESSION['field_Phone']; // Accessories $field_Charger = $_POST['field_Charger'] = $_SESSION['field_Charger']; $field_Case = $_POST['field_Case'] = $_SESSION['field_Case']; $field_Manual = $_POST['field_Manual'] = $_SESSION['field_Manual']; $field_Box = $_POST['field_Box'] = $_SESSION['field_Box']; // Item Condition $field_Condition = $_POST['field_Condition'] = $_SESSION['field_Condition']; Here's the item from the database: <?php // DB Query $query = "SELECT * FROM phones WHERE name = '{$field_Phone}'"; $result = mysql_query($query); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $output[] = '<a href="cart-demo/cart.php?action=add&id='.$row['id'].'">Add to cart</a>'; } ?> Here's the functions that output the product selected: <?php function writeShoppingCart() { $cart = $_SESSION['cart']; if (!$cart) { return 'Cart (Empty)'; } else { // Parse the cart session variable $items = explode(',',$cart); $s = (count($items) > 1) ? 's':''; return 'Cart (<a href="cart-demo/cart.php">'.count($items).'</a>)'; } } function showCart() { global $db; $cart = $_SESSION['cart']; if ($cart) { $items = explode(',',$cart); $contents = array(); foreach ($items as $item) { $contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1; } $output[] = '<form action="cart.php?action=update" method="post" id="cart">'; $output[] = '<table>'; foreach ($contents as $id=>$qty) { $sql = 'SELECT * FROM phones WHERE id = '.$id; $result = $db->query($sql); $row = $result->fetch(); extract($row); $output[] = '<tr>'; $output[] = '<td><a href="cart.php?action=delete&id='.$id.'" class="r">Remove</a></td>'; $output[] = "<td>" .$name. "</td>"; $output[] = "<td><img src=\"../images/catalog-images/" .$photo_image. "\" width=\"50\"/></td>"; $output[] = "<td> ".$_SESSION['accessories']." </td>"; $output[] = '<td> $ '.$price.'</td>'; $output[] = '<td><input type="text" name="qty'.$id.'" value="'.$qty.'" size="3" maxlength="3" /></td>'; $output[] = '<td> $'.($base_price * $qty).'</td>'; $total += $base_price * $qty; $output[] = '</tr>'; } $output[] = '</table>'; $output[] = '<p>Grand total: <strong>$ '.$total.'</strong></p>'; $output[] = '<div><button type="submit">Update cart</button></div>'; $output[] = '</form>'; } else { $output[] = '<p>You shopping cart is empty.</p>'; } return join('',$output); } ?> Here's the cart code: $cart = $_SESSION['cart']; $action = $_GET['action']; $_SESSION['accessories']; switch ($action) { case 'add': if ($cart) { $cart .= ','.$_GET['id']; } else { $cart = $_GET['id']; } break; case 'delete': if ($cart) { $items = explode(',',$cart); $newcart = ''; foreach ($items as $item) { if ($_GET['id'] != $item) { if ($newcart != '') { $newcart .= ','.$item; } else { $newcart = $item; } } } $cart = $newcart; } break; case 'update': if ($cart) { $newcart = ''; foreach ($_POST as $key=>$value) { if (stristr($key,'qty')) { $id = str_replace('qty','',$key); $items = ($newcart != '') ? explode(',',$newcart) : explode(',',$cart); $newcart = ''; foreach ($items as $item) { if ($id != $item) { if ($newcart != '') { $newcart .= ','.$item; } else { $newcart = $item; } } } for ($i=1;$i<=$value;$i++) { if ($newcart != '') { $newcart .= ','.$id; } else { $newcart = $id; } } } } } $cart = $newcart; break; } $_SESSION['cart'] = $cart;
  9. Hi We've been battling this site for weeks, and finally ended up just iframing the old php stuff into Joomla and making it look better. It worked in a subfolder. Then we moved it up and BLAM. We have 2 problems: 1, one of the order online accessories pages just stopped working. It's giving us a header error message. "Cannot modify header information, headers already sent" when added to the cart. (The product is added to the cart though." 2. We can no longer access the cart admin, perhaps because it shares the root with Joomla and joomla isn't looking 'outside' of itself. None of us are professional coders here, and the site is already live. Can anyone give any advice please?
×
×
  • 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.