/**
  * Display widget content
  */
 public function widget($args, $instance)
 {
     $cart = MalsCart::getInstance();
     echo $args['before_widget'];
     if (!empty($instance['title'])) {
         echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
     }
     echo $cart->render('contents');
     echo $args['after_widget'];
 }
 /**
  * Display widget content
  *
  * This widget will only be displayed on single product pages.
  */
 public function widget($args, $instance)
 {
     if (!is_singular(CGIT_PRODUCT_POST_TYPE)) {
         return;
     }
     $cart = MalsCart::getInstance();
     echo $args['before_widget'];
     if (!empty($instance['title'])) {
         echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
     }
     echo $cart->render('add');
     echo $args['after_widget'];
 }
Beispiel #3
0
<?php

use Cgit\Products\MalsCart;
use Cgit\Products\Product;
if (!is_singular(CGIT_PRODUCT_POST_TYPE)) {
    return;
}
global $post;
$product = new Product($post->ID);
$cart = MalsCart::getInstance();
?>
<div class="mals-cart-add">
    <form action="<?php 
echo $cart->urls['add'];
?>
" method="post">

        <input type="hidden" name="userid" value="<?php 
echo CGIT_MALS_CART_ID;
?>
" />
        <input type="hidden" name="product[]" value="<?php 
echo $product->post_title;
?>
" />
        <input type="hidden" name="price" value="<?php 
echo $product->product_price;
?>
" />
        <input type="hidden" name="return" value="<?php 
echo get_permalink($product->ID);
/**
 * Get cart object
 */
function cgit_mals_cart()
{
    return MalsCart::getInstance();
}