/** * Loops over the items in the cart * * Example usage: * if ( shopp('cart.has-items') ) * while ( shopp('cart.items') ) * shopp('cartitem.name'); * * @api `shopp('cart.items')` * @since 1.0 * * @param string $result The output * @param array $options The options * @param ShoppCart $O The working object * @return bool True if there is a next item, false otherwise **/ public static function items($result, $options, $O) { if (!isset($O->_item_loop)) { $O->rewind(); $O->_item_loop = true; } else { $O->next(); } if ($O->valid()) { return true; } else { unset($O->_item_loop); $O->rewind(); return false; } }