Example #1
0
    ?>
"><img src="<?php 
    echo $plandd_option['week-offer']['url'];
    ?>
" alt=""></a>
              </figure>
            </h1>
            <?php 
}
?>
            
            <?php 
if (is_user_logged_in()) {
    global $current_user;
    $page = get_page_by_title('Meu pedido');
    $cart = new PlanDD_Cart($post->ID, $current_user->ID);
    ?>
            <h1 class="shop-car right no-margin rel">
              <a href="<?php 
    echo get_page_link($page->ID);
    ?>
" title="Seu carrinho de pedidos" class="rel">
                <span class="icon-carshop icon-icon_carrinho  left"></span>
                <span class="icon-chevron-down icon-icon_down_2 left secondar"></span>
                <span class="qtd-cart bg-primary abs"><?php 
    $cart->get_total_items_cart();
    ?>
</span>
              </a>
              <div id="item-list-user">
                <?php 
Example #2
0
                  $custom_fields = get_post_custom($post->ID);
                  
                  if(null != $custom_fields['produto_codigo'][0])
                    printf('<p><strong>Código: </strong>%s</p>',$custom_fields['produto_codigo'][0]);

                  if(null != $custom_fields['produto_ref'][0])
                    printf('<p><strong>Referência do produto: </strong>%s</p>',$custom_fields['produto_ref'][0]);

                  echo "<p><strong>Fabricante</strong>: {$terms[0]->name}</p>";

                  if(null != $custom_fields['produto_descricao'][0])
                    echo get_field('produto_descricao',$post->ID);

                  if ( is_user_logged_in() ) {
                    global $current_user;
                    $cart = new PlanDD_Cart($post->ID,$current_user->ID);
                    $cart->show_controls_qtd();
                  }
                ?>
              </div>
              <div class="divide-30"></div>

              <header class="divide-20 post-header">
                <p class="primary font-regular no-margin"><strong>Especificações técnicas</strong></p>
              </header>

              <nav class="divide-30">
                <ul class="small-16 left">
                  <?php
                    $especs = get_field('produto_espcs',$post->ID);
                    if($especs) {
Example #3
0
function update_items_cart()
{
    $user_id = $_GET['user_id'];
    $item_id = (int) $_GET['item_id'];
    $total_item = (int) $_GET['total_item'];
    $user = get_user_by('id', $user_id);
    if ($user) {
        $user_cart = get_user_meta($user_id, 'user_cart', true);
        $total_cart = 0;
        if ($total_item > 0) {
            $user_cart[$item_id] = $total_item;
            update_user_meta($user_id, 'user_cart', $user_cart);
            foreach ($user_cart as $key => $value) {
                $total_cart += $value;
            }
        } else {
            unset($user_cart[$item_id]);
            update_user_meta($user_id, 'user_cart', $user_cart);
            foreach ($user_cart as $key => $value) {
                $total_cart += $value;
            }
        }
        $cart = new PlanDD_Cart($item_id, $user_id);
        $json = array("total" => $total_cart, "list" => $cart->list_items_cart());
        print json_encode($json);
    }
    exit;
}