Jump to content

masterdrue

Member
  • Posts

    8
  • Joined

  • Last visited

Everything posted by masterdrue

  1. Hi Ben. Yes, I was moving along through during the unset of update and revisited that and saw, public function empty_cart() { unset($_GET['cart']); } public function empty_cart() { unset($_SESSION['cart']); } I think my eyes were crossed for days. All is fine now.
  2. Hi Gang, I'm somewhere between video 24 and 27 building the display of the cart contents and have run into a snag. When I put the echo in to see the array that items are being added to the cart, this working as designed. When i comment it out, and hit cart.php?empty.. the cart does not empty, though it does redirect. As I've re-watched the video's a number of times.. I'm sure like last time its some syntax error I'm missing and I've also compared nearly line by line from the source and haven't seen it. (which doesnt mean I still didnt miss it comparing it) /** * Empties items to the cart * * @access public * @param * @return null */ public function empty_cart() { unset($_GET['cart']); } /* Create page parts */ /** * Return a string containing list items for each product in cart * * @access public * @param * @return string */ public function create_cart() { //get products currently in cart $products = $this->get(); $data = ''; $total = 0; $data .= '<li class="header_row"><div class="col1">Product Name:</div><div class="col2">Quantity:</div><div class="col3">Product Price:</div><div class="col4">Total Price:</div></li>'; if($products != '') { // products to display } else { // no products to display $data .= '<li><strong>No items in the cart!</strong></li>'; // add subtotal row $data .= '<li class="subtotal_row"><div class="col1">Subtotal:</div><div class="col2">$0.00</div></li>'; // add total row $data .= '<li class="total_row"><div class="col1">Total:</div><div class="col2">$0.00</div></li>'; } echo "<pre>"; print_r($products); echo "</pre>"; return $data; } } Also I do get the alert "items emptied from cart", but I'm fairly certain that their still there in relation to the video because the empty and update cart buttons do not appear as shown in the video once a successful "empty" happens. v_public_cart.php <div id="content"> <h2>Shopping Cart</h2> <ul class="alerts"> <?php $this->get_alerts();?> </ul> <form action="" method="post"> <ul class="cart"> <?php $this->get_data('cart_rows');?> </ul> <div class="buttons_row"> <a class="button_alt" href="?empty">Empty Cart</a> <input type="submit" name="update" class="button_alt" value="Update Cart"> </div> </form> <form action="" method="post"> <div class="submit_row"> <input type="submit" name="submit" class="button" value="Pay with Paypal"> </div> </form> </div> Any idea's what to look for? Or is another way to purge the cart aside hitting the URL. Which leaves once the cart is emptied, will the buttons appear again. Any help and feedback as always is greatly appreciated. Thanks, Drue
  3. Success... Unbelievable.. After line by line review, watching the video's umpteen more times.. i discovered that I misused the comparison operator in the get set data function in m_template.php. Before public function set_data($name, $value, $clean = FALSE) { if($clean = TRUE) //Notice 1 equal { $this->data[$name] = htmlentities($value, ENT_QUOTES); } else { $this->data[$name] = $value; } } After public function set_data($name, $value, $clean = FALSE) { if($clean == TRUE) { $this->data[$name] = htmlentities($value, ENT_QUOTES); } else { $this->data[$name] = $value; } } Unbelievable how 1 oversight can completely stop production.
  4. Strange because I followed each video to suite..but theres always a margin for a typo.. I did perform the checks as was demonstrated. I'll go back through and swap out source for my code to see if i can isolate it and hone in on it.. thanks again..
  5. Hi Ben, Thanks for the response. I assume your asking for m_template.php, if it's another file, let me know.. Thanks again.. /* Template Class handles all templating tasks - displaying views, alerts, errors and view data */ class Template { private $data; private $alert_types = array('success', 'alert','error'); function __construct(){} /* * Loads specified url * * @access public * @param string, string * @return null */ public function load($url, $title = '') { if($title !=''){$this->set_data('page_title',$title);} include($url); } /* * Redirects to specified url * * @access public * @param string * @return null */ public function redirect($url) { header("Location: $url"); exit; } /* Get Set Data */ /* * Saves provided data for use by the view later * * @access public * @param string, string, bool * @return null */ public function set_data($name, $value, $clean = FALSE) { if($clean = TRUE) { $this->data[$name] = htmlentities($value, ENT_QUOTES); } else { $this->data[$name] = $value; } } /* * Retrieves data based on provided name for access by view * * @access public * @param string, bool * @return string */ public function get_data($name, $echo = TRUE) { if(isset($this->data[$name])) { if($echo) { echo $this->data[$name]; } else { return $this->data[$name]; } } return ''; } /* Get Set Alerts */ /* * Sets an alert message stored in the session * * @access public * @param string, string (optional) * @return null */ public function set_alert($value, $type = 'success') { $_SESSION[$type][]=$value; } /* * Returns strings, containing multiple list items of alerts * * @access public * @param * @return null */ public function get_alerts() { $data =''; foreach($this->alert_types as $alert) { if (isset($_SESSION[$alert])) { foreach($_SESSION[$alert] as $value) { $data.= '<li class="' . $alert . '">' . $value . '</li>'; } unset($_SESSION[$alert]); } } echo $data; } }
  6. Hi.. Going through video's 11-12 for the creation of (m_categories.php), when I added the line of code, <?php $this->get_data('page_nav'); ?> in public header I ended up with a navigation that displayed the "li" tags themselves in the navigation. Index.php <li class="active"><a href="http://localhost/dapouda/">View All</a></li><li><a href="http://localhost/dapouda/index.php?id=3">Clothing</a></li><li><a href="http://localhost/dapouda/index.php?id=2">Electronics</a></li><li><a href="http://localhost/dapouda/index.php?id=1">Toys</a></li> So I went back through both videos and checked line for line any possible typo's, then copied in the project source to see if it would work correctly and I get the same result. Also note, that I did get the correct array output from the part of "echo pre tags" section. I rechecked public header <div class="secondarynav"> <strong>0 items ($0.00) in cart</strong> | <a href="<?php echo SITE_PATH;?>cart.php">Shopping Cart</a> </div> <h1><?php echo SITE_NAME; ?></h1> <ul class="nav"> <?php $this->get_data('page_nav'); ?> </ul> which appears to match the source project also. m_categories.php /* Create page parts */ /** * Returns an unordered list of links to all category pages * * @access public * @param string (optional) * @return string */ public function create_category_nav($active = NULL) { // get all categories $categories = $this->get_categories(); // set up all item $data = '<li'; if (strtolower($active) == 'home') { $data .= ' class="active"'; } $data .= '><a href="' . SITE_PATH . '">View All</a></li>'; // loop through each category if ( ! empty($categories)) { foreach($categories as $category) { $data .= '<li'; if (strtolower($active) == strtolower($category['name'])) { $data .= ' class="active"'; } $data .= '><a href="' . SITE_PATH . 'index.php?id=' . $category['id'] . '">' . $category['name'] . '</a></li>'; } } return $data; } One thing I did notice in Chromes view, was quotes after UL (see nav-error2).. So I'm ultimately at a loss and hope you can steer me down the right path. Thanks... Drue
  7. Hi all.. I noticed that on killersites a new announcement for IPad support was added for the video section. Was wondering when or if the video subscription side was going to support IPad..??? Thanks, Drue
  8. Ipad support for the subscription courses coming any time soon?

    1. administrator

      administrator

      The new KS library now supports iPad:

       

      http://library.killersites.com/

×
×
  • Create New...