WordPress.org

Ready to get started?Download WordPress

Forums

Cart66 Shopping cart [shortcode] outside of main content area. (2 posts)

  1. LukeJonGibson
    Member
    Posted 2 years ago #

    Hi there,

    I'm using Cart66, and I'm getting a bit stuck with a small design element. I want the shopping cart widget to appear outside of the main content area with out having to create multiple loops just to contain the shortcode.

    Does anyone know the what code is being inserted by the shortcode [shopping_cart] before it's executed on the page? I tried viewing the source, but it seems to be executed server side as only html is outputted.

    If not, does anyone have any idea where/how I might be able to find out?

    Kind Regards

    Luke

  2. LukeJonGibson
    Member
    Posted 2 years ago #

    I went digging through the plugin code pages and found the source code I want to execute on the page, but it doesn;t seem to be executing properly, can anyone good with php help me figure why it's not working? Cheers

    <?php
    
    class Cart66ShortcodeManager {
    
      public $manualIsOn;
    
      /**
       * Short code for displaying shopping cart including the number of items in the cart and links to view cart and checkout
       */
      public function shoppingCart($attrs) {
        $cartPage = get_page_by_path('store/cart');
        $checkoutPage = get_page_by_path('store/checkout');
        $cart = Cart66Session::get('Cart66Cart');
        if(is_object($cart) && $cart->countItems()) {
          ?>
          <div id="Cart66scCartContents">
            <a id="Cart66scCartLink" href='<?php echo get_permalink($cartPage->ID) ?>'>
            <span id="Cart66scCartCount"><?php echo $cart->countItems(); ?></span>
            <span id="Cart66scCartCountText"><?php echo $cart->countItems() > 1 ? ' items' : ' item' ?></span>
            <span id="Cart66scCartCountDash">–</span>
            <span id="Cart66scCartPrice"><?php echo CART66_CURRENCY_SYMBOL .
              number_format($cart->getSubTotal(), 2); ?>
            </span></a>
            <a id="Cart66scViewCart" href='<?php echo get_permalink($cartPage->ID) ?>'>View Cart</a>
            <span id="Cart66scLinkSeparator"> | </span>
            <a id="Cart66scCheckout" href='<?php echo get_permalink($checkoutPage->ID) ?>'>Check out</a>
          </div>

Topic Closed

This topic has been closed to new replies.

About this Topic