Jump to content

Cart icon to navbar


Recommended Posts

Dear community,

 

I apologize for my lack of experience in.php.

 

How do I move the cart from the multi_template_default to the header_page_manager.

 

What I did was move the cart code from multi_template_default.php to header_page_manager.php but the page breaks down, I guess it isn't that simple.

 

Any experienced user willing to give me some guidance on what else needs to be done? Thank you in advance.

 

    <div class="row">
      <div class="col-md-12 group">
        <span class="col-md-10 float-end text-end headerMultiTemplateDefaultCartLink">
<?php
  if ($CLICSHOPPING_ShoppingCart->getCountContents() > 0) {
?>
         <ul>
          <li class="dropdown headerMultiTemplateDefaultShoppingCart">
            <a class="dropdown-toggle headerMultiTemplateDefaultShoppingCart" data-bs-toggle="dropdown" href="#"><?php echo '<i class="bi bi-cart-fill headerMultiTemplateDefaultShoppingCart" aria-hidden="true"></i>&nbsp;&nbsp;&nbsp;&nbsp;' . $shopping_cart ?></a>
            <ul class="dropdown-menu">
              <li role="separator"></li>
<?php
  $products = $CLICSHOPPING_ShoppingCart->get_products();

  foreach ($products as $k => $v) {
    echo '<li class="headerMultiTemplateDefaultLi">&nbsp;&nbsp;
            <span class="float-start">' . $v['quantity'] . ' - ' . $v['name'] . '</span>
            <span class="float-end">' .  $CLICSHOPPING_Currencies->displayPrice($v['final_price'], $CLICSHOPPING_Tax->getTaxRate($v['tax_class_id']), $v['quantity']) . '</span>
         </li>
         ';
  }
?>
                <li role="separator" class="h-divider"></li>
                <li class="headerMultiTemplateDefaultLi">&nbsp;&nbsp;
                  <span class="float-start"><?php echo CLICSHOPPING::getDef('modules_header_multi_template_shopping_cart_total_content'); ?></span>
                  <span class="float-end text-end"><?php echo $CLICSHOPPING_Currencies->format($CLICSHOPPING_ShoppingCart->show_total()); ?></span>
                </li>
                <li role="separator" class="h-divider"></li>
                <li class="headerMultiTemplateDefaultLi">
                  <span class="float-start headerMultiTemplateDefaultShoppingSmallCart"><i class="bi bi-cart-fill">&nbsp;&nbsp;</i><?php echo HTML::link(ClicShopping::link(null, 'Cart'), CLICSHOPPING::getDef('modules_header_multi_template_shopping_cart_view_cart')); ?></span>
                  <span class="float-end headerMultiTemplateDefaultCheckout"><i class="bi bi-arrow-right-square-fill"></i>&nbsp;&nbsp;<?php echo HTML::link(ClicShopping::link(null, 'Checkout&Shipping'), CLICSHOPPING::getDef('modules_header_multi_template_shopping_cart_checkout')); ?></span>
                </li>
              </ul>
            </li>
         </ul>
 <?php
  } else {
    echo '<ul>
            <li class="headerMultiTemplateDefaultShoppingCart"><i class="bi bi-cart-fill headerMultiTemplateDefaultShoppingCart" aria-hidden="true"></i>&nbsp;&nbsp;&nbsp;&nbsp;' . CLICSHOPPING::getDef('modules_header_multi_template_shopping_cart_no_content') . '</li>
         </ul>
         ';
  }
?>
        </span>
      </div>
    </div>

 

Link to post

Hello,

 

First, do not change anything inside the Default template directory.

Create another directory, copy all css inside this directory

Now you can just copy the file you want to change.

For example

Default

    header.php

Mytemplate

   css

   header.php

 

The header will be overrided

 

Like that if you want to update the solution, it will be better for the maintenance and you can do all that you want inside this files. Sames approach for the module and files directory (respect the structure)

 

About your question

I do not understand what you want to do. Inside the admin you can select where you want to display a module.

The module page manager is only created to display the content information.

 

The best approach if want to do something is to create your own module and work inside.

Look the bm_shopping_cart inside the the boxes directory, you will have all the information you must need.

 

 

 

 

 

 

 

 

Link to post

Thanks for the time you took to answer. I am not looking for the shopping cart box.

 

I would like to move the header shopping cart instead (the one on the header, with a dropdown and a cart icon).

 

It is the code which I literally pasted on my previous post. I can't find that in any module, only there.

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use