[SOLVED Cannot get add to cart buttons to display

  • Posts: 62
  • Thank you received: 0
12 years 11 months ago #37410

Hi,

- Hikashop Business 1.5.6 J! 1.73.3
- In "Default parameters for products" I have "Display Add To Cart" button selected but there is no button appearing (see attached). The form is there but there is no button control HTML markup. This happens for all my products. I have also made sure that the price for the products is visible to *all* user levels of access.

I would appreciate any pointers. I am short on time and need to launch the shop ASAP.

Attachments:
Last edit: 12 years 11 months ago by TheEdge.

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

  • Posts: 62
  • Thank you received: 0
12 years 11 months ago #37439

Bump

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

  • Posts: 83103
  • Thank you received: 13415
  • MODERATOR
12 years 11 months ago #37445

That's the default options for NEW menus and modules.
You will find similar options for each one of your menus and modules via the menu Display->Content modules/menus. So make sure that you set it there too.

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

  • Posts: 62
  • Thank you received: 0
12 years 11 months ago #37468

Hi Nicolas,

Thanks for getting back to me. However I am still missing something.

There appears to be no module for the product listing itself within the category which is where I want to add the buttons. And then also how do I add the module that will be for the particular product(s)?

I attach a screen shot showing the new menu item I added Shop2 of a category listing and what I end up with.

Attachments:

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

  • Posts: 83103
  • Thank you received: 13415
  • MODERATOR
12 years 11 months ago #37473

In your menu, there is a link to the options of the "associated products listing module for your menu". That's where you will see the option.

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

  • Posts: 45
  • Thank you received: 2
12 years 11 months ago #37493

this helped me, too. i did that once, but forgot how it worked in a new installation.

i think this option is not placed in a good position, because i haven't activated that module.

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

  • Posts: 62
  • Thank you received: 0
12 years 11 months ago #37571

nicolas wrote: In your menu, there is a link to the options of the "associated products listing module for your menu". That's where you will see the option.

Nope still not. See attached screenshot. I have now published that module and made sure that the radio buttons are correctly selected and still no joy.

This is getting desperate.... Can anyone shed any light?

Attachments:

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

  • Posts: 62
  • Thank you received: 0
12 years 11 months ago #37577

Looks to me that add_to_cart_listing.php does not have code in it to actually output the button? I include my code (unmodified from install) below.

There is no ELSE part to the if test:

if(!$this->config->get('ajax_add_to_cart',0)

And even if I turn on AJAX I still don't see any valid output.
<?php
/**
 * @package    HikaShop for Joomla!
 * @version    1.5.6
 * @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');
?>
  <form action="<?php echo hikashop_completeLink('product&task=updatecart'); ?>" method="post" name="hikashop_product_form_<?php echo $this->row->product_id.'_'.$this->params->get('main_div_name'); ?>"><?php
    if($this->params->get('display_custom_item_fields',0) && empty($this->row->has_options) && ($this->row->product_quantity==-1 || $this->row->product_quantity>0)&& !$this->config->get('catalogue') && ($this->config->get('display_add_to_cart_for_free_products') || !empty($this->row->prices))){
      $itemFields = $this->fieldsClass->getFields('frontcomp',$this->row,'item','checkout&task=state');
      $null=array();
      $this->fieldsClass->addJS($null,$null,$null);
      $this->fieldsClass->jsToggle($itemFields,$this->row,0);
      $extraFields = array('item'=>&$itemFields);
      $requiredFields = array();
      $validMessages = array();
      $values = array('item'=>$this->row);
      $this->fieldsClass->checkFieldsForJS($extraFields,$requiredFields,$validMessages,$values);
      $this->fieldsClass->addJS($requiredFields,$validMessages,array('item'));
      if(!empty($itemFields)){
       ?>
      <!-- CUSTOM ITEM FIELDS -->
      <div id="hikashop_product_custom_item_info_for_product_<?php echo $this->row->product_id; ?>" class="hikashop_product_custom_item_info hikashop_product_listing_custom_item">
        <table class="hikashop_product_custom_item_info_table hikashop_product_listing_custom_item_table" width="100%">
        <?php
        foreach($itemFields as $fieldName => $oneExtraField) {
          $itemData = JRequest::getString('item_data_'.$fieldName,$this->row->$fieldName);  ?>
          <tr id="hikashop_item_<?php echo $oneExtraField->field_namekey; ?>" class="hikashop_item_<?php echo $oneExtraField->field_namekey;?>_line">
            <td class="key">
              <span id="hikashop_product_custom_item_name_<?php echo $oneExtraField->field_id;?>_for_product_<?php echo $this->row->product_id; ?>" class="hikashop_product_custom_item_name">
                <?php echo $this->fieldsClass->getFieldName($oneExtraField);?>
              </span>
            </td>
            <td>
              <span id="hikashop_product_custom_item_value_<?php echo $oneExtraField->field_id;?>_for_product_<?php echo $this->row->product_id; ?>" class="hikashop_product_custom_item_value">
                <?php $onWhat='onchange'; if($oneExtraField->field_type=='radio') $onWhat='onclick'; ?>
                <?php echo $this->fieldsClass->display($oneExtraField,$itemData,'data[item]['.$oneExtraField->field_namekey.']',false,' '.$onWhat.'="if (\'function\' == typeof window.hikashopToggleFields) { hikashopToggleFields(this.value,\''.$fieldName.'\',\'item\',0); }"'); ?>
              </span>
            </td>
          </tr>
        <?php
          }?>
        </table>
      </div>
      <!-- EO CUSTOM ITEM FIELDS -->
    <?php }
    }
    $this->ajax='';
    if(!$this->config->get('ajax_add_to_cart',0)||!empty($itemFields)){
    $this->ajax = 'if(hikashopCheckChangeForm(\'item\',\'hikashop_product_form_'.$this->row->product_id.'_'.$this->params->get('main_div_name').'\')){ return hikashopModifyQuantity(\''.$this->row->product_id.'\',field,1,\'hikashop_product_form_'.$this->row->product_id.'_'.$this->params->get('main_div_name').'\'); } return false;';
    }
    $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="product_id" value="<?php echo $this->row->product_id; ?>" />
    <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>

Last edit: 12 years 11 months ago by TheEdge.

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

  • Posts: 62
  • Thank you received: 0
12 years 11 months ago #37600

Bump. Sorry to be a pain but I need to get this solved. Site is supposed to go live tomorrow. :-(

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

  • Posts: 83103
  • Thank you received: 13415
  • MODERATOR
12 years 11 months ago #37612

Hi,

The add to cart button is not displayed in that view file but in the file "quantity" of the view "product".

If you don't see the add to cart button, it's because of that display add to cart button option which is not turned on on your products listing module. Make sure that you turn it on for ALL of the modules.
If that's the case, then you should not see it either on the product page and it can come form several things:
1. The catalogue mode option of the config is turned on.
2. The product has not price and the option "Display 'add to cart' button for free products" is turned off.
3. The product has no stock.
4. There is CSS hiding the button.

If you want to bypass all these in the quantity view file, that's possible by replacing the whole code of that view by just:
echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax,'',$this->row->product_max_per_order,$this->row->product_min_per_order);

Then the add to cart button will always display.

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

  • Posts: 62
  • Thank you received: 0
12 years 11 months ago #37960

Hi Nicolas,

Appreciate all your help with this. It appears that the catalogue option was turned ON. Once that is off I can once again add items to the shopping cart.

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

Time to create page: 0.091 seconds
Powered by Kunena Forum