I
I
Ivan Drozhzhin2015-10-27 12:06:54
PHP
Ivan Drozhzhin, 2015-10-27 12:06:54

Why can't I change the parent block?

Good afternoon.
There is a task, for two blocks to change the parent element to a higher one. Online store on opencart.
I open the category.tpl file, find the part of the code I need:

<div class="product-grid-list">
  <ul class="product-list" id="product-list-grid">
    <?php foreach ($products as $product) { ?>
    <li>
  <div class="product-block">
  <div class="product-block-inner">
        <?php if ($product['thumb']) { ?>
        <div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
        <?php } ?>
   	<div class="saleblock">
    	    <?php if (!$product['special']) { ?>       
        <?php } else { ?>
          <span class="saleicon sale">Sale</span>         
        <?php } ?>
    </div>
      <div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div>
        <div class="description"><?php echo $product['description']; ?></div>
            <?php if ($product['price']) { ?>
                <div class="price">
                <?php if (!$product['special']) { ?>
                <?php echo $product['price']; ?>
                <?php } else { ?>
                    <div class='categorysalevis'><span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span></div>
                <?php } ?>
                <?php if ($product['tax']) { ?>
                    <br />
                    <span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span>
                <?php } ?>
                </div>
            <?php } ?>
            <?php if ($product['rating']) { ?>
                <div class="rating"><img src="catalog/view/theme/<?php echo $this->config->get('config_template') ?>/image/stars-<?php echo $product['rating']; ?>.png" alt="<?php echo $product['reviews']; ?>" /></div>
            <?php } ?>
            <div class="cart">
                <input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" />
            </div>
        <div class="wishlist" style="display:none;"></div>
        <div class="compare" style="display:none;"></div>
    </div>
</div>
    </li>
    <?php } ?>
  </ul>
</div>

The price block (class='price') and the add-to-cart block (class='cart') I need to place in a parent block (class="product-block"). The usual copy-paste did not change anything. Ok, I tried to just wrap them (along with the rating block) in another div. I look in the inspector and damn ... no ... Ok, but am I editing the right file? I add a class to the .price block, for example, .privet. I open the inspector....shit...commented out this whole part of the code and everything broke on the page...So the file is the same, but for some reason new classes and blocks are not added. Maybe I'm doing something wrong? Maybe some function somewhere is responsible for the output of this part of the code? The magic I do not understand
ZY PHP I know at the level of a baby

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question