A
A
Artyom Tsvetkov2015-10-17 05:18:27
PHP
Artyom Tsvetkov, 2015-10-17 05:18:27

Nothing happens when you click the "buy" button?

If you follow the link ( satservis.by/sputnikovieantenni_acsesyari/sputniko... ) and click the "buy" button, no action will happen.

<?php echo $header; ?>
<div class="breadcrumb">
<?php foreach ($breadcrumbs as $breadcrumb) { ?>
<?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
<?php } ?>
</div>
<div id="content"><?php echo $content_top; ?>
  <h2><?php echo $heading_title; ?></h2>
  <?php if ($thumb || $description) { ?>
<div>
  <div class="panel panel-info hidden-xs">
  <div class="panel-body text">
  <?php if ($thumb) { ?>
    <div class="image"><img src="<?php echo $thumb; ?>" alt="<?php echo $heading_title; ?>" />
    </div>
    </div>
    <?php } ?>
    <?php if ($description) { ?>
    <?php echo $description; ?>
    <?php } ?>
  </div>
  <?php } ?>
  <?php if ($categories) { ?>
  <div class="category-list">
<h2><?php echo $text_refine; ?></h2>
  <div class="category-list">
    <?php if (count($categories) <= 5) { ?>
    <ul>
      <?php foreach ($categories as $category) { ?>
      <li><a href="<?php echo $category['href']; ?>"><img src="<?php echo $category['thumb']; ?>"><span><?php echo $category['name']; ?></a></span></li>
      <?php } ?>
    </ul>
    <?php } else { ?>
    <?php for ($i = 0; $i < count($categories);) { ?>
    <ul>
      <?php $j = $i + ceil(count($categories) / 4); ?>
      <?php for (; $i < $j; $i++) { ?>
      <?php if (isset($categories[$i])) { ?>
      <li><a href="<?php echo $categories[$i]['href']; ?>"><img src="<?php echo $categories[$i]['thumb']; ?>"><span><?php echo $categories[$i]['name']; ?></span></a></li>
      <?php } ?>
      <?php } ?>
    </ul>
    <?php } ?>
    <?php } ?>
  </div>
  <?php } ?>
  <?php if ($products) { ?>
  <div class="product-filter">
    <div class="display"><b><?php echo $text_display; ?></b> <?php echo $text_list; ?> <b>/</b> <a onclick="display('grid');"><?php echo $text_grid; ?></a></div>
    <div class="limit"><b><?php echo $text_limit; ?></b>
      <select onchange="location = this.value;" input class="input-mini">
        <?php foreach ($limits as $limits) { ?>
        <?php if ($limits['value'] == $limit) { ?>
        <option value="<?php echo $limits['href']; ?>" selected="selected"><?php echo $limits['text']; ?></option>
        <?php } else { ?>
        <option value="<?php echo $limits['href']; ?>"><?php echo $limits['text']; ?></option>
        <?php } ?>
        <?php } ?>
      </select>
    </div>
  
    <div class="sort"><b><?php echo $text_sort; ?></b>
      <select onchange="location = this.value;">
        <?php foreach ($sorts as $sorts) { ?>
        <?php if ($sorts['value'] == $sort . '-' . $order) { ?>
        <option value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?></option>
        <?php } else { ?>
        <option value="<?php echo $sorts['href']; ?>"><?php echo $sorts['text']; ?></option>
        <?php } ?>
        <?php } ?>
      </select>
    </div>
  </div>
  <div class="product-list">
    <?php foreach ($products as $product) { ?>
    <div>
      <?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="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 { ?>
        <span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span>
        <?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/default/image/stars-<?php echo $product['rating']; ?>.png" alt="<?php echo $product['reviews']; ?>" /></div>
      <?php } ?>
      <div class="cart">
<button class="btn btn-small btn-success" type="button" onclick="top.location.href=('<?php echo $product['href']; ?>');"/><?php echo $button_info; ?></button>
<button class="btn btn-primary" id="button-cart" type="button" onclick="addToCart('<?php echo $product['product_id']; ?>');"/><?php echo $button_cart; ?></button>
</div>
      
      
    </div>
    <?php } ?>
  </div>
  <div class="pagination"><?php echo $pagination; ?></div>
  <?php } ?>
  <?php if (!$categories && !$products) { ?>
  <div class="content"><?php echo $text_empty; ?></div>
  <div class="buttons">
    <div class="right"><a href="<?php echo $continue; ?>" class="button"><?php echo $button_continue; ?></a></div>
  </div>
  <?php } ?>
  <?php echo $content_bottom; ?></div>
<script type="text/javascript"><!--
function display(view) {
  if (view == 'list') {
    $('.product-grid').attr('class', 'product-list');
    
    $('.product-list > div').each(function(index, element) {
      html  = '<div class="right">';
      html += '  <div class="cart">' + $(element).find('.cart').html() + '</div>';
      
      
      html += '</div>';			
      
      html += '<div class="left">';
      
      var image = $(element).find('.image').html();
      
      if (image != null) { 
        html += '<div class="image">' + image + '</div>';
      }
      
      var price = $(element).find('.price').html();
      
      if (price != null) {
        html += '<div class="price">' + price  + '</div>';
      }
          
      html += '  <div class="name">' + $(element).find('.name').html() + '</div>';
      html += '  <div class="description">' + $(element).find('.description').html() + '</div>';
      
      var rating = $(element).find('.rating').html();
      
      if (rating != null) {
        html += '<div class="rating">' + rating + '</div>';
      }
        
      html += '</div>';
            
      $(element).html(html);
    });		
    
    $('.display').html('<b><?php echo $text_display; ?></b> <img src="/catalog/view/theme/satservis/image/list_off.png" /> <a onclick="display(\'grid\');"><img src="/catalog/view/theme/satservis/image/grid_on.png" /></a>');
    
    $.totalStorage('display', 'list'); 
  } else {
    $('.product-list').attr('class', 'product-grid');
    
    $('.product-grid > div').each(function(index, element) {
      html = '';
      
      var image = $(element).find('.image').html();
      
      if (image != null) {
        html += '<div class="image">' + image + '</div>';
      }
      
      html += '<div class="name">' + $(element).find('.name').html() + '</div>';
      html += '<div class="description">' + $(element).find('.description').html() + '</div>';
      
      var price = $(element).find('.price').html();
      
      if (price != null) {
        html += '<div class="price">' + price  + '</div>';
      }
      
      var rating = $(element).find('.rating').html();
      
      if (rating != null) {
        html += '<div class="rating">' + rating + '</div>';
      }
            
      html += '<div class="cart">' + $(element).find('.cart').html() + '</div>';
    
      
      
      $(element).html(html);
    });	
          
    $('.display').html('<b><?php echo $text_display; ?></b> <a onclick="display(\'list\');"><img src="/catalog/view/theme/satservis/image/list_on.png" /></a>  <img src="/catalog/view/theme/satservis/image/grid_off.png" />');
    
    $.totalStorage('display', 'grid');
  }
}

view = $.totalStorage('display');

if (view) {
    display(view);
} else {
    display('grid');
}
//--></script> 
<?php echo $footer; ?>

Answer the question

In order to leave comments, you need to log in

3 answer(s)
C
Cat Anton, 2015-10-17
@27cm

Can't find function addToCart().
5d1d8099040a465fb82108ff4dc49919.png

V
Vladislav Byvshev, 2015-10-22
@glk92

I looked at the page code, I didn’t see the connection of the common.js file (this function is written there) in the head,
connect common.js in <head>....</head>:
and also the buy button is implemented through the link <a></a>...
Replaced by
or
if it doesn't help look for the problem in the common.js file

W
web-mechanic, 2015-10-28
@amfetamine

first repair the site, a lot of errors! prntscr.com/8w24y2
how to fix everything, in particular errors with jQuery, everything should work

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question