title: how to calculate discount based on category of products on shopping cart page in opencart?
body: <p>I want to group and display products on shopping cart page by category wise. I mean to say that, if we have four products, then it should be shown like below:</p>
  
  <blockquote>
    <h1>Category 1</h1>
    
    <ul>
    <li>product i</li>
    <li>product ii</li>
    </ul>
    
    <h1>Category 2</h1>
    
    <ul>
    <li>product i</li>
    <li>product ii</li>
    </ul>
  </blockquote>
  
  <p>I also would like to store the total amount of each category value, in an array. I'm trying to implement category wise discount.
  Thanks.</p>
  
  <p><strong>EDITED:-</strong>
  This is my shopping cart page, where I'm trying to display discount based on the category of products
  <img src="https://i.stack.imgur.com/dVSVz.png" alt="enter image description here"></p>
  
  <p>Suppose, if there are two products in the cart and they belong to two different category. Now I want to calculate discount based on the number of quantity of each category.
  I have created a module in admin section where I'm setting all the required values, and storing it to the table in database.</p>
  
  <p><img src="https://i.stack.imgur.com/Mbx3F.png" alt="enter image description here"></p>
  
  <p>Now, based on the values set in the admin I'm trying to implement discount on shopping cart page. But I'm not getting any idea, how could i do that ?</p>
  
  <blockquote>
    <p>That's why I have no code to place here. </p>
  </blockquote>
  
  <p>please give some idea, so that i can try creating something.
  thanks!!</p>
  
  <p>Following is my requirement --</p>
  
  <blockquote>
    <ol>
    <li><p>Sale and Delivery Terms:</p>
    
    <ul>
    <li>for orders exceeding 600 Francs, delivery is free of charge;</li>
    <li>for orders less than the above, a delivery charge of 20 Francs, will apply;</li>
    </ul></li>
    <li><p>Discounts and Quantities</p>
    
    <ul>
    <li><p>Red Wines, White Wines:</p>
    
    <ul>
    <li>from 36 bottles, each of 750ml, 6% discount;</li>
    <li>from 60 bottles, each of 750ml, 10% discount;</li>
    <li>from 84 bottles, each of 750ml, 13% discount.</li>
    </ul></li>
    <li><p>Fortified Wines (sweet):</p>
    
    <ul>
    <li>from 12 bottles, each of 750ml, 5% discount.</li>
    </ul></li>
    <li><p>Discount on Pick up:</p>
    
    <ul>
    <li>from 24 bottles, each of 750ml, 3% discount.</li>
    </ul></li>
    <li><p>Cash Payment:</p>
    
    <ul>
    <li>from 24 bottles, each of 750ml, 3% discount.</li>
    </ul></li>
    <li><p>Cash Payment on Delivery:</p>
    
    <ul>
    <li>3% discount.</li>
    </ul></li>
    </ul></li>
    </ol>
  </blockquote>