| 1 |
<?php |
| 2 |
/** |
| 3 |
* WPPIZZA_MARKUP_HIDDENCART Class |
| 4 |
* |
| 5 |
* @package WPPIZZA |
| 6 |
* @subpackage WPPizza Hidden Cart |
| 7 |
* @copyright Copyright (c) 2015, Oliver Bach |
| 8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 |
* @since 3.0 |
| 10 |
* |
| 11 |
*/ |
| 12 |
if ( ! defined( 'ABSPATH' ) ) exit;/*Exit if accessed directly*/ |
| 13 |
|
| 14 |
/* ================================================================================================================================= * |
| 15 |
* |
| 16 |
* |
| 17 |
* |
| 18 |
* CLASS - WPPIZZA_MARKUP_HIDDENCART |
| 19 |
* |
| 20 |
* |
| 21 |
* |
| 22 |
* ================================================================================================================================= */ |
| 23 |
|
| 24 |
class WPPIZZA_MARKUP_HIDDENCART{ |
| 25 |
|
| 26 |
/****************************************************************************** |
| 27 |
* |
| 28 |
* |
| 29 |
* [construct] |
| 30 |
* |
| 31 |
* |
| 32 |
*******************************************************************************/ |
| 33 |
function __construct() { |
| 34 |
/* include an invisible cart on orderpage including is open check*/ |
| 35 |
add_action('wp_footer', array( $this, 'hidden_cart'),99); |
| 36 |
} |
| 37 |
|
| 38 |
/****************************************************************************** |
| 39 |
* |
| 40 |
* |
| 41 |
* [methods] |
| 42 |
* |
| 43 |
* |
| 44 |
*******************************************************************************/ |
| 45 |
|
| 46 |
/******************************************************* |
| 47 |
* add hidden input/div - when open - to orderpage |
| 48 |
* to be be able to still add things to cart and reload (for upsells, cart amendments etc) |
| 49 |
* orderpage only - let's not worry about caching as the orderpage should never be cached anyway |
| 50 |
* add class if open - used in javascripts for alert when closed - class set to -novis , |
| 51 |
* to not write to element when adding to cart (only carts with wppizza-cart will be written to) |
| 52 |
******************************************************/ |
| 53 |
function hidden_cart(){ |
| 54 |
if(wppizza_is_orderpage() && wppizza_is_shop_open()){ |
| 55 |
echo'<span class="'.WPPIZZA_PREFIX.'-open '.WPPIZZA_PREFIX.'-cart-novis" style="display:none"></span>'; |
| 56 |
} |
| 57 |
} |
| 58 |
} |
| 59 |
/*************************************************************** |
| 60 |
* |
| 61 |
* [ini] |
| 62 |
* |
| 63 |
***************************************************************/ |
| 64 |
if(!is_admin()){ |
| 65 |
$WPPIZZA_MARKUP_HIDDENCART = new WPPIZZA_MARKUP_HIDDENCART(); |
| 66 |
} |
| 67 |
?> |