Changeset 339 for trunk


Ignore:
Timestamp:
Oct 29, 2008 12:09:10 AM (16 years ago)
Author:
quinn
Message:

Added example cli script, updated Cart.inc.php

Location:
trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/examples/_config.inc.php

    r316 r339  
    2222define('SITE_BASE', dirname(__FILE__));
    2323
    24 // Set include path for all templates.
     24// Set include path for all templates and libraries.
    2525ini_set('include_path', join(PATH_SEPARATOR, array(
    2626    COMMON_BASE,
  • trunk/lib/Cart.inc.php

    r336 r339  
    157157                    'extended_price' => $quantity * $item['price'],
    158158                ));
    159             }           
     159                return true;
     160            } else {
     161                return false;
     162            }
     163            return true;
     164        }
     165    }
     166   
     167    /*
     168    * Set the absolute price value of a specified item in a cart.
     169    *
     170    * @access   public
     171    * @param   
     172    * @return   
     173    * @author   Quinn Comendant <quinn@strangecode.com>
     174    * @version  1.0
     175    * @since    10 May 2008 16:42:25
     176    */
     177    function setPrice($item_id, $price)
     178    {
     179        if (isset($_SESSION['_cart'][$this->_ns]['items'][$item_id])) {
     180            $item = $_SESSION['_cart'][$this->_ns]['items'][$item_id];
     181            $_SESSION['_cart'][$this->_ns]['items'][$item_id] = array_merge($item, array(
     182                'price' => $price,
     183                'extended_price' => $price * $item['quantity'],
     184            ));
     185            return true;
     186        } else {
     187            return false;
    160188        }
    161189    }
     
    177205            unset($_SESSION['_cart'][$this->_ns]['items'][$item_id]);
    178206            $app->logMsg(sprintf('Removed %s from cart', $item_id), LOG_DEBUG, __FILE__, __LINE__);
     207            return true;
     208        } else {
     209            return false;
    179210        }
    180211    }
Note: See TracChangeset for help on using the changeset viewer.