D
D
DevTeam2015-12-04 21:44:31
PHP
DevTeam, 2015-12-04 21:44:31

When clicking on the picture of the product was added to the cart, how to do it?

Help me make it so that when you click on the picture, the product is added to the cart
Here is a piece of code here it is so when you click on the picture, go to the page with the product

<div class="row category-layout">
  <?php foreach ($categories as $category) { ?>
  <div class="col-md-2">
    <div class="category-thumb transition">
      <div class="image"><a href="<?php echo $category['href']; ?>"><img src="<?php echo $category['thumb']; ?>" alt="<?php echo $category['name']; ?>" title="<?php echo $category['name']; ?>" class="img-responsive" /></a></div>
      <div class="caption">
        <h4 class="text"><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a></h4>
      </div>
    </div>
  </div>
  <?php } ?>
  
</div>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
web-mechanic, 2015-12-05
@amfetamine

I don’t understand, where does the piece of code with the output of categories come from :) You can do it as in Sergey’s comment above, or by hanging a handler on the click event.

D
DevTeam, 2015-12-06
@DevelopersTeam

I did everything myself)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question