OpenCart: Where is the div for the drop down header cart info?
Asked Answered
H

2

13

I am trying to style OpenCart but am having difficulty finding which TPL file holds the div that appears when you click the Shopping Cart icon in the header (the 'mini cart' that slides down - it allows you to view what's in your cart without going to the cart page).

Does anyone know where I can find the .tpl file that has this div (in the default structure template)? Thanks

enter image description here

Hassan answered 23/7, 2012 at 23:11 Comment(10)
Maybe this would be a more appropriate place for this question: forum.opencart.comPrivative
Thanks, Yeah I've tried there as well.Hassan
Were they able to provide a solution?Privative
Unfortunately not, which is why I posted here (I think there's more OpenCart forum activity here)Hassan
Have you used the inspector in Chrome (Firebug in Firefox, or similar) to figure out idetifying information about the DIV (like an id) and then searched the OpenCart repository for instances of this?Privative
Yes I have - it has the class "content", but there are about 35 .tpl files with many "content" divsHassan
@PhpMyCoder Why should he try their forums when this is a place for asking questions about OpenCart. Downvote I wish I could on your stupidityJorry
Exactly. I agree with @PhpMyCoder is bonkers.Diplococcus
@Jorry There are 361 questions about Opencart on SO. There are 60777 on the official Opencart Forum. I wasn't telling him off (I did, if you noticed, provide some steps to try to find the DIV himself), but merely suggesting that he might find more knowledge about Opencart on their forums.Privative
@MeltingDog....Thank for provide good questions.Make cheer up with us....Trichotomy
D
14

Why did people downvote you?

The #content DIV sits within the #cart DIV - you should have searched this.

Open /catalog/view/theme/default/template/common/header.tpl

The cart header is in the echo

<?php echo $cart; ?>

To see the code view /catalog/view/theme/default/template/module/cart.tpl (in version v1.5.3.1)

The section is in the top within .mini-cart-info class. Example from some of the code snippet below:

<div id="cart">
  <div class="heading">
    <h4><?php echo $heading_title; ?></h4>
    <a><span id="cart-total"><?php echo $text_items; ?></span></a></div>
  <div class="content">
    <?php if ($products || $vouchers) { ?>
    <div class="mini-cart-info">
      <table>
        <?php foreach ($products as $product) { ?>
        <tr>
          <td class="image"><?php if ($product['thumb']) { ?>
            <a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" title="<?php echo $product['name']; ?>" /></a>
            <?php } ?></td>
          <td class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a>
            <div>
Diplococcus answered 24/7, 2012 at 11:2 Comment(5)
+1 for the effort and details. True, a good question no need for downvote.Jorry
Thanks guys - yeah I dont know why I was down voted. Maybe because I put PHP as a tag. Thanks heaps for your answers!Hassan
I added those tags but.. this is PHP and it is Drop-Down related. Haters just hate.Diplococcus
I am curious where is the code that that puts the cart header in the $cart variable for use in header.tpl ? There is nothing in header.php controller that I can find. I figure it's some system wide convention/implementation that a template once rendered is stored in a variable with the same name as the template ?Bedraggle
Look above. That is inside a module. view/module/module.tpl' notice that the strings this uses is from header.php` and also in header.php the language files are loaded too.. look at controller/module/cart.php too and this is confirmedDiplococcus
J
1

I agree With @TheBlackBenzKid.

1) View file can be found with below path

"catalog/view/theme/default/template/module/cart.tpl" .

2) Controller file can be found with below path

"catalog/controller/module/cart.php" . 

Below link can provide you where to modify the files related to the header drop-down cart. I have give instruction how to modify and created another drop down similar with previous.

Please have a look on this link "https://github.com/pantlavanya/copy-opencart-mini-cart"

Josejosee answered 12/10, 2015 at 11:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.