Characteristics Size Not Adding To Cart

  • Posts: 964
  • Thank you received: 11
  • Hikashop Business
11 years 6 months ago #100087

I haven't used characteristics much so please bear with me. I followed the instructions in the documentation and I got this far.

What I need to know is if I have a product that has 2 small, 2 medium and 2 large sizes, I add the quantity (2) of each size in the characteristics but what quantity do I put on the main product? Do I put the total quantity (6) of all products or leave it blank?

I keep adding a different size to the cart but it keeps adding the amount to one size, the first size that I add. So for example, the first size I add to the cart was "large". I then went back to the product and add 1 medium and 1 small but it's showing 3 large, instead of 1 small, 1 medium and 1 large. So I must have missed a step.

Thank you!!

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
11 years 6 months ago #100198

Hi,

Can you show me how did you configured your product page and the product's variants that you are adding to your cart through some screenshots ?

It would help me to understand what your problem really is :).

Please Log in or Create an account to join the conversation.

  • Posts: 964
  • Thank you received: 11
  • Hikashop Business
11 years 6 months ago #100425

I've attached a product page screen shot and a variant screen shot. Not sure if those are the pages you need.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82760
  • Thank you received: 13346
  • MODERATOR
11 years 6 months ago #100699

Could you provide a link to that product page on your frontend so that we can see the issue ?

Please Log in or Create an account to join the conversation.

  • Posts: 964
  • Thank you received: 11
  • Hikashop Business
11 years 6 months ago #100704

Hi Nicolas,

I PM the link. Thank you!

Please Log in or Create an account to join the conversation.

  • Posts: 82760
  • Thank you received: 13346
  • MODERATOR
11 years 6 months ago #101166

The issue is that you moved the </form> element of the "show" view at the end instead of having it just after the line:
<input type="hidden" name="return_url" value="<?php echo urlencode(base64_encode(urldecode($this->redirect_url)));?>"/>

or something like that.

So it comes from the customization that you made on the show view file or one of its sub views.

Because of that, it is always the id of the last variant which is used as it is the last one defined and because the variants data is inside the form where it should be outside.

Please Log in or Create an account to join the conversation.

  • Posts: 964
  • Thank you received: 11
  • Hikashop Business
11 years 6 months ago #101221

Thank you I will move that.

What I need to know is if I have a product that has 2 small, 2 medium and 2 large sizes, I add the quantity (2) of each size in the characteristics but what quantity do I put on the main product? Do I put the total quantity (6) of all products or leave it blank?


What is the proper way to do the above please? Thank you!

Please Log in or Create an account to join the conversation.

  • Posts: 964
  • Thank you received: 11
  • Hikashop Business
11 years 6 months ago #101243

So now I'm real nervous as I have no clue what customization would have changed that :(

I found the line of code you mentioned in product > listing_div but the <form> is below it, unless I'm misunderstanding what you mean. This is how it looks:

  <input type="hidden" name="return_url" value="<?php echo urlencode(base64_encode(urldecode($this->redirect_url)));?>"/>
  </form>

Here is the code in product > listing_div. I would forever be greatful if you can tell me what's messed up...
<?php
/**
 * @package  HikaShop for Joomla!
 * @version  2.0.0
 * @author  hikashop.com
 * @copyright  (C) 2010-2012 HIKARI SOFTWARE. All rights reserved.
 * @license  GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
$mainDivName=$this->params->get('main_div_name');
$carouselEffect=$this->params->get('carousel_effect');
$enableCarousel=$this->params->get('enable_carousel');

$textCenterd=$this->params->get('text_center');
$this->align="left";
if($textCenterd){
  $this->align="center";
}
$height=$this->params->get('image_height');
$width=$this->params->get('image_width');
$this->borderClass="";

if($this->params->get('border_visible',1) == 1){
  $this->borderClass="hikashop_subcontainer_border";
}
if($this->params->get('border_visible',1) == 2){
  $this->borderClass="thumbnail";
}
if(empty($width) && empty($height)){
  $width=$this->image->main_thumbnail_x;
  $height=$this->image->main_thumbnail_y;
}
$row = reset($this->rows);
$this->image->checkSize($width,$height,$row);
$this->newSizes= new stdClass();
$this->newSizes->height=$height;
$this->newSizes->width=$width;
$this->image->main_thumbnail_y=$height;
$this->image->main_thumbnail_x=$width;

if((!empty($this->rows) || !$this->module || JRequest::getVar('hikashop_front_end_main',0)) && $this->pageInfo->elements->total){
  $pagination = $this->config->get('pagination','bottom');
  if(in_array($pagination,array('top','both')) && $this->params->get('show_limit') && $this->pageInfo->elements->total){
    $this->pagination->form = '_top';
?>
  <form action="<?php echo hikashop_currentURL(); ?>" method="post" name="adminForm_<?php echo $this->params->get('main_div_name').$this->category_selected;?>_top">
    <div class="hikashop_products_pagination hikashop_products_pagination_top">
    <?php echo $this->pagination->getListFooter($this->params->get('limit')); ?>
    <span class="hikashop_results_counter"><?php echo $this->pagination->getResultsCounter(); ?></span>
    </div>
    <input type="hidden" name="filter_order_<?php echo $this->params->get('main_div_name').$this->category_selected;?>" value="<?php echo $this->pageInfo->filter->order->value; ?>" />
    <input type="hidden" name="filter_order_Dir_<?php echo $this->params->get('main_div_name').$this->category_selected;?>" value="<?php echo $this->pageInfo->filter->order->dir; ?>" />
    <?php echo JHTML::_( 'form.token' ); ?>
  </form>
<?php
  }
?>
  <div class="hikashop_products">
<?php

  if(!empty($this->rows)){

    if ($this->config->get('show_quantity_field')>=2) {
?>
    <form action="<?php echo hikashop_completeLink('product&task=updatecart'); ?>" method="post" name="hikashop_product_form_<?php echo $this->params->get('main_div_name'); ?>" enctype="multipart/form-data">
<?php
    }
    if($enableCarousel){
      $this->setLayout('carousel');
      echo $this->loadTemplate();
    }
    else
    {
      $columns = (int)$this->params->get('columns');
      if(empty($columns) || $columns<1) $columns = 1;
      $width = (int)(100/$columns)-1;
      $current_column = 1;
      $current_row = 1;

      if(HIKASHOP_J30) {
        switch($columns) {
          case 12:
          case 6:
          case 4:
          case 3:
          case 2:
          case 1:
            $row_fluid = 12;
            $span = $row_fluid / $columns;
            break;
          case 10:
          case 8:
          case 7:
            $row_fluid = $columns;
            $span = 1;
            break;
          case 5:
            $row_fluid = 10;
            $span = 2;
            break;
          case 9: // special case
            $row_fluid = 10;
            $span = 1;
            break;
        }
        if($row_fluid == 12)
          echo '<div class="row-fluid"><ul class="thumbnails">';
        else
          echo '<div class="row-fluid-'.$row_fluid.'"><ul class="thumbnails">';
      }

      foreach($this->rows as $row){
        if(!HIKASHOP_J30) {
if((int)$width == 24)$width = 25;
      ?>
      <div class="hikashop_product hikashop_product_column_<?php echo $current_column; ?> hikashop_product_row_<?php echo $current_row; ?>" style="width:<?php echo $width;?>%;">
        <div class="hikashop_container">
          <div class="hikashop_subcontainer <?php echo $this->borderClass; ?>">
<?php
        } else {
?>
      <li class="span<?php echo $span; ?> hikashop_product hikashop_product_column_<?php echo $current_column; ?> hikashop_product_row_<?php echo $current_row; ?>">
        <div class="hikashop_container">
          <div class="hikashop_subcontainer <?php echo $this->borderClass; ?>">
<?php
        }

        $this->row =& $row;
        $this->setLayout('listing_'.$this->params->get('div_item_layout_type'));
        echo $this->loadTemplate();

        if(!HIKASHOP_J30) {
?>
          </div>
        </div>
      </div>
<?php
        } else {
?>
          </div>
        </div>
      </li>
<?php
        }
        if($current_column>=$columns){
          $current_row++;
          if(!HIKASHOP_J30) {
?>
      <div style="clear:both"></div>
<?php
          }
          $current_column=0;
        }
        $current_column++;
      }

      if(HIKASHOP_J30) {
        echo '</ul></div>';
      }
    }
?>
      <div style="clear:both"></div>
<?php
    if ($this->config->get('show_quantity_field')>=2) {
      $this->ajax = 'if(hikashopCheckChangeForm(\'item\',\'hikashop_product_form_'.$this->params->get('main_div_name').'\')){ return hikashopModifyQuantity(\'\',field,1,\'hikashop_product_form_'.$this->params->get('main_div_name').'\'); } return false;';
      $this->row = new stdClass();
      $this->row->prices = array($this->row);
      $this->row->product_quantity = -1;
      $this->row->product_min_per_order = 0;
      $this->row->product_max_per_order = -1;
      $this->row->product_sale_start = 0;
      $this->row->product_sale_end = 0;
      $this->setLayout('quantity');
      echo $this->loadTemplate();
      if(!empty($this->ajax) && $this->config->get('redirect_url_after_add_cart','stay_if_cart')=='ask_user'){
?>
      <input type="hidden" name="popup" value="1"/>
<?php
      }
?>
      <input type="hidden" name="hikashop_cart_type_0" id="hikashop_cart_type_0" value="cart"/>
      <input type="hidden" name="add" value="1"/>
      <input type="hidden" name="ctrl" value="product"/>
      <input type="hidden" name="task" value="updatecart"/>
      <input type="hidden" name="return_url" value="<?php echo urlencode(base64_encode(urldecode($this->redirect_url)));?>"/>
     </form>
<?php
    }
  }
?>
  </div>
  <?php if(in_array($pagination,array('bottom','both')) && $this->params->get('show_limit') && $this->pageInfo->elements->total){ $this->pagination->form = '_bottom'; ?>
  <form action="<?php echo hikashop_currentURL(); ?>" method="post" name="adminForm_<?php echo $this->params->get('main_div_name').$this->category_selected;?>_bottom">
    <div class="hikashop_products_pagination hikashop_products_pagination_bottom">
    <?php echo $this->pagination->getListFooter($this->params->get('limit')); ?>
    <span class="hikashop_results_counter"><?php echo $this->pagination->getResultsCounter(); ?></span>
    </div>
    <input type="hidden" name="filter_order_<?php echo $this->params->get('main_div_name').$this->category_selected;?>" value="<?php echo $this->pageInfo->filter->order->value; ?>" />
    <input type="hidden" name="filter_order_Dir_<?php echo $this->params->get('main_div_name').$this->category_selected;?>" value="<?php echo $this->pageInfo->filter->order->dir; ?>" />
    <?php echo JHTML::_( 'form.token' ); ?>
  </form>
<?php }
}
?>

Please Log in or Create an account to join the conversation.

  • Posts: 82760
  • Thank you received: 13346
  • MODERATOR
11 years 6 months ago #101513

You're not looking at the correct file.

The modifications which cause that issue are either in the show or the show_default or other show_* view files, not in listing view files.

Please Log in or Create an account to join the conversation.

  • Posts: 964
  • Thank you received: 11
  • Hikashop Business
11 years 6 months ago #101529

Hi Nicolas,

I don't think it's something I did then because the files below are the ONLY files that I edited in the product view. And there is only one other file with the "show" name (order > show) and it does not have the code you mentioned.

In addition, out of those files the product > listing_div is the only one that have the code you mentioned.

product > listing_div
product > quantity
product > show_block_img
product > show_default

Thanks!!

Please Log in or Create an account to join the conversation.

  • Posts: 82760
  • Thank you received: 13346
  • MODERATOR
11 years 6 months ago #101721

I never mentioned the listing_div file.

I however mentioned the show file, and I can assure you that there is the line I talked about in it.

Please Log in or Create an account to join the conversation.

  • Posts: 964
  • Thank you received: 11
  • Hikashop Business
11 years 6 months ago #101735

I know that you DID NOT mention the product > listing_div I was just making a point that the ONLY file that I edited that have that code you provided is the product > listing_div file.

When I look in the backend it shows me which files I edited by displaying the "remove customization" icon. There are no other files with the word "show" in them that I edited asides from the ones listed above.

I guess I just have to replace the files and start over then to get this working but it makes no sense if I did not edit it/them :(

Last edit: 11 years 6 months ago by MyWorld.

Please Log in or Create an account to join the conversation.

  • Posts: 82760
  • Thank you received: 13346
  • MODERATOR
11 years 6 months ago #101818

The fact that the input form tag moved doesn't necessarily means that you moved it. It can potentially come from the fact that you moved some other HTML incorrectly.

You say that you changed the show_default, quantity and show_block_img view files. All these view files are called by the product page display and depending on how you altered them, it could produce such result.

I'm sorry but I can't tell precisely what code is wrong and where, but I don't know what you changed... All I can say is that I see that the HTML has been moved around compared to the default display and that is what is causing the problem.

Please Log in or Create an account to join the conversation.

  • Posts: 964
  • Thank you received: 11
  • Hikashop Business
11 years 6 months ago #101823

Hi Nicolas,

First, I just want you to know that I REALLY appreciate your help and patience. I'm sure the mix up is due to my ignorance with php/code.

I will get the original files and replace them with the files in my template that I'm using and try to do a process of elimination and hopefully sort this out asap. Oddly enough this is one of the things that I have to get working so I have to figure it out.

Thanks again...

Please Log in or Create an account to join the conversation.

  • Posts: 964
  • Thank you received: 11
  • Hikashop Business
11 years 6 months ago #101856

Took me all day but I got it - just hope I didn't mess anything else... :lol: The problem was in the product > show_default file.

I know I asked this a couple times but I still didn't get a reply.

...If I have a product that has 2 small, 2 medium and 2 large sizes, I add the quantity (2) for each size in the characteristics - correct? And what quantity do I put on the main product? Do I put the total quantity (6) of all products or leave it blank?


Thank you!!

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
11 years 6 months ago #101928

You can leave it blank, filling the main product quantity will be useful if you don't fill you product's variants quantity, then your variant will share the same quantity with the main product.

Last edit: 11 years 6 months ago by Mohamed Thelji.

Please Log in or Create an account to join the conversation.

  • Posts: 964
  • Thank you received: 11
  • Hikashop Business
11 years 6 months ago #102014

Sorry but I just want to ensure that I understand this and that it is done correctly.

If I ONLY put the total amount (6) on the main product, will it know how many of each size is available for each characteristic? For example, if the 2 smalls are sold out will it know? or if one medium is sold out and one is left will it know?

I was thinking that I should put the total amount of all the products (6) on the main product and then the quantity for each product size (2) in the characteristics? Is that not how it should work?

I am trying to get from you the proper way to do this so that it works correctly.

Thank you!!

Please Log in or Create an account to join the conversation.

  • Posts: 82760
  • Thank you received: 13346
  • MODERATOR
11 years 6 months ago #102024

You can potentially put the total quantity in the main product.
You can also leave it unlimited.
If you fill the quantity for each variant, it doesn't matter. If you set the total quantity, the system will update it. If you don't then it won't do it. But that has no influence on the product availability since it's the variants quantity which is used.

Please Log in or Create an account to join the conversation.

Time to create page: 0.099 seconds
Powered by Kunena Forum