Jump to content
Sign in to follow this  
Webdevelopers

Порядок в сопутствующих товарах

Recommended Posts

Подскажите пожалуйста!!!В админке в товаре в связях (opencart 1.5.5.1) есть сопутствующие товары, при добавлении например товар1, товар2, товар3 после нажатия сохранить изменяется порядок. Как сделать чтобы бы порядок не менялся?

Share this post


Link to post
Share on other sites

выводятся они у меня в продукт тпл как их отсортировать по имени?

<div  class="related <?php echo $carous;?>">
          <div class="box-product" style="margin-top: 5px;"> 
            <?php foreach ($products as $product) { ?>
            <div style="margin-top: 5px;">
 <?php if ($product['thumb']) { ?>
              <div class="image" style="display: none;"><a href="<?php echo $product['href']; ?>"><img id="img_<?php echo $product['product_id']; ?>" src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" /></a></div>
              <?php } ?>
              <div class="fas_name"><?php echo $product['name']; ?></div>
              <?php if ($product['price']) { ?>
              <div class="price" style="float: left; width: 483px; padding: 7px;">
                <?php if (!$product['special']) { ?>
                <div style="float: left; width: 325px; color:#5B5A58; font-weight:bold; font-size:19px; padding: 5px 0 0 10px;"><?php echo $product['price']; ?></div>
                <?php } else { ?>
                <div style="width: 325px; float: left; padding: 5px 0 0 10px;"> 
<span style="color:#62BD21; font-weight:bold; font-size:20px;"><?php echo $product['special']; ?></span>
<span style="text-decoration:line-through; color:#5B5A58; font-weight:bold; font-size:17px;"><?php echo $product['price']; ?></span>
</div>
                <?php } ?>
<input type='text' id='quant_<?php echo $product['product_id']; ?>' name='quantity' size='2' maxlength='3' value='1' style='' /> 
<div class="cart" style="float: right; margin: -14px 0 0 7px;"><a onclick="addToCart('<?php echo $product['product_id']; ?>', document.getElementById('quant_<?php echo $product['product_id']; ?>').value);" class="button" style="width: 80px; text-align: center;"><span><?php echo $button_cart; ?></span></a></div>
              </div>
              <?php } ?>
            </div>
<div class="clear"></div>
            <?php } ?>
          </div>

Share this post


Link to post
Share on other sites

Подскажите как отсортировать массив, есть товар 5мл, товар 10 мл, товар 100 мл. при сортировке через sort($massiv) сортирует в таком порядке товар 10 мл,товар 100 мл, товар 5мл. а необходимо товар 5, товар 10, товар 100.

Share this post


Link to post
Share on other sites

Попробуйте так: 

sort($massiv, SORT_NATURAL)

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.