A variant with no price disappears in cart?

  • Posts: 37
  • Thank you received: 4
  • Hikashop Business
10 years 8 months ago #146343

-- url of the page with the problem -- : debroodloods.nl
-- HikaShop version -- : HikaShop Business: 2.3.0
-- Joomla version -- : 3.2.2
-- PHP version -- : x.x.x
-- Browser(s) name and version -- : FF 27.0.1
-- Error-message(debug-mod must be tuned on) -- : (in dutch) Het artikel Broodje: Kadet Wit is niet beschikbaar


Hi Nicolas,

For a webshop selling sandwiches, i made variants of bread the customer can order.

Kadet white
kadet brown
Multicorn (+0,50)

So when a customer orders a sandwich with cheese, they can choose on what type of bread they want it.


The problem:
Some variants are with no price (kadet white). But when you add the article with kadet white to the cart and proceed in the ordering process, an error occurs. (in dutch) Het artikel Broodje: Kadet Wit is niet beschikbaar (engish, the article is not available?)

The variants with a price (like multicorn) works ok!


My client doenst want a price on the kadet. In theorie u can make the product € 0,10 cheaper, and add a variant of € 0,10. But my client doenst want that.

Can you help me out? Why is it obliged to have a price?

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 8 months ago #146457

Hi,

It's probably doing that because you turned off the option "display add to cart button for free products" in the configuration of HikaShop.

The following user(s) said Thank You: plaag666

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

  • Posts: 37
  • Thank you received: 4
  • Hikashop Business
10 years 8 months ago #146474

Excellent, i changed the option to yes, and works fine.


Thanks!!

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

  • graveltravel
10 years 2 months ago #169726

Hello,

Hoped I could solve this issue just by switching on the Free product button.... But no, it didn't work for me.

I created 1 set with 3 variants, and left everything to default. On the product the variants appeared, but vanish when I select a variant.

I fiddled with the prices and other properties of the variants, but no luck.

What's next?

Thanks, Eric





Attachments:
Last edit: 10 years 2 months ago by graveltravel. Reason: Insert of images.

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

  • graveltravel
10 years 2 months ago #169831

Hi,

I did a lot of fiddling with the variants. But no way that I managed to get it working. I removed and added the variant, added and removed mrsp and other prices, tried all possible combinations. Added additional properties to variants, changed from physical to virtual products, and vice versa. Turned on Free products' button.... But whatever I do, it simply won't work. The cart button keeps disappearing when a variant is selected.

I did remove some of the Views a couple of weeks ago. But I guess that has nothing to do with viewing buttons when selecting another variant.

So, a friendly but urgent request to have a look at this issue!

Thanks, Eric

Have a look at shop.graveltravel.nl/hikashop-menu-for-b...oute-self-drive.html

Last edit: 10 years 2 months ago by graveltravel. Reason: Adding link with example

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

  • graveltravel
10 years 2 months ago #169839

Hi,

More fiddling, my conclusion: there is something seriously wrong with the variants. I did the following simple test:

I created the following product with 2 variants:

Main product: mrsp 1 euro
Variant 1-1: mrsp 2 euro
Variant 1-2: mrsp 3 euro (default variant)

In the shop I selected the product, and saw the following:

The Normal Price is taken from the default variant, 3 euro's. That is incorrect, should be the mrsp price of 1 euro coming from the main product. The second price says Free (gratis), that is also incorrect because the price is 3 euro's for variant 2 which is the default. And where is my cart button? Also not good! See image below.



If I select Variant 2 the price changes to 2 euro, Which is correct. But the cart button still does not appears, and the sales price of the product remains Gratis (free), incorrect.



Using the Pricing tables of the products and variants gives more less the same results. I did found a combinated use of mrsp and price table that gave the correct price on screen, enabled the cart button, but resulted in a 0 euro product in the cart. Which was also incorrect.

Guys, have a look, this is really not how it should work. Or give me clear instructions to solve this.

Awaiting your professional reply, Eric ;-)

Attachments:

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

  • graveltravel
10 years 2 months ago #169849

Just did another combination that failed ;-( I removed the mrsp prices from the main and variants, and stored the prices in the price table. The Free (gratis) is not there anymore and the prices seem to be okay. But when selecting another variant the cart buttons are removed. Not funny ;-)

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

  • graveltravel
10 years 2 months ago #169855

Hi,

And more test results:

If I choose List as layout for the variants it works.The Dropdown, Table and Radio Button are all having the same problem. And finally the Dropdown and Table have the same layout, what shouldn't be the case.

So, I believe that the script behind the on-change event on the Dropdown and Radio Button is not okay.

Kind regards, Eric



Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 2 months ago #169919

Hi,

This often happens when customizing the product page layout and breaking the HTML code resulting in the variants system not able to switch the elements on the page properly.
Unfortunately, the link that you provided displays a product page without any characteristic selection dropdown so that I couldn't test the problem on your website in order to give more details on a potential solution.
I also checked other products on your website and they were working fine but they didn't had any characteristic.
So please provide a link to a working example so that we can see the problem.

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

  • graveltravel
10 years 2 months ago #169975

Hi Nicolas,

Thanks for your reply :-)

I did not make any changes to the HTML wahtsoever. So, this can't be causing the problem.

To avoid problems I've temporarely chosen the 'list' layout for variants. It works, but is not what I want :-) The list with variants is shown below the product descriptrion. I'll set it back to dropdown so you can see the result yourself. The link I've send you does have variants. So does the other products under Reizen/Groepsreizen (= Travel/Group Travel). The variants are the scheduled periods.

I did send your credentials a few weeks ago. If you need them again to logon just let me know ;-)

shop.graveltravel.nl/product-groepen-4x4...akantie-marokko.html

Kind regards, Eric

Last edit: 10 years 2 months ago by graveltravel. Reason: added link to product

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 2 months ago #169982

Hi,

As far as I can see in the HTML, the problem is that the right panel HTML is included inside the price area and thus when the characteristic is changed and the price updated, the rest of the right panel is removed.
So it looks like a customization issue since you have the latest version of HikaShop and that we don't have the problem on our end.
So I would recommend to go in the menu Display>Views and search for the "show_tabular" file and remove the customization with the bin icon in the column of the same name.

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

  • graveltravel
10 years 2 months ago #170118

Hi Nicolas,

Thanks for your reply. Indeed, there was a modification on the show_tabular for the rnshop template. I'm the only one with access, and I didn't make the changes. So, I guess I maybe had have a look and saved and close the file without making changes. Whatever ;-)

I removed the modification, cleared the cache etc, and no luck. The same behaviour is still there and the buttons are hidden after selecting another variant.

What is next?

Kind regards, Eric

LS: I only made changes to listing_price to enable PER_UNIT, PER_PERSON and PER_DAY. This is working fine. Another modification came with the rnshop template, category listing_title. It basically uses another class for displaying a category listing title.

Last edit: 10 years 2 months ago by graveltravel. Reason: Brief explanation modifcations.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 2 months ago #170129

Hi,

So it's probably because of the modification of listing_price which is used for the display of the price itself in the show_tabular view file.
Try to remove it (you can always reapply the modification after and do it step by step to see where the problem is coming from) in the same way you did for the show_tabular view file.

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

  • graveltravel
10 years 2 months ago #170247

Hi Nicolas,

Yes, you were right! I'm sorry, but PHP is not really my thing ;-)

I tried to embed PER_DAY and PER_PERSON but missed something. I added a field sales_uom to the product table to hold the units PER_UNIT, PER_DAY and PER_PERSON according to the documentation on your website. The code is a part of the view listing_price. Can you please have a look at the code below?

Thanks, Eric


if(isset($price->price_min_quantity) && empty($this->cart_product_price) && $this->params->get('per_unit',1)){
if($price->price_min_quantity>1){

/* Original
echo '<span class="hikashop_product_price_per_unit_x">'.JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>'; */

/* Modified by Eric Plugge */
if($this->row->sales_uom == 'PER_DAY'){
echo '<span class="hikashop_product_price_per_unit_x">'.JText::sprintf('PER_DAY_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>';
} else if($this->row->sales_uom == 'PER_PERSON'){
echo '<span class="hikashop_product_price_per_unit_x">'.JText::sprintf('PER_PERSON_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>';
} else
{
echo '<span class="hikashop_product_price_per_unit_x">'.JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>';
}

}else{

/* echo '<span class="hikashop_product_price_per_unit">'.JText::_('PER_UNIT').'</span>'; */

/* www.hikashop.com/support/faq.html#each */
if(isset($this->element->main)) echo '<span class="hikashop_product_price_per_unit">'.JText::_($this->element->main->sales_uom);
elseif(isset($this->row)) echo '<span class="hikashop_product_price_per_unit">'.JText::_($this->row->sales_uom);
else echo '<span class="hikashop_product_price_per_unit">'.JText::_($this->element->sales_uom);

}
}

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 2 months ago #170248

It's not really about PHP, but HTML.
In the last piece of your code you have:
f(isset($this->element->main)) echo '<span class="hikashop_product_price_per_unit">'.JText::_($this->element->main->sales_uom);
elseif(isset($this->row)) echo '<span class="hikashop_product_price_per_unit">'.JText::_($this->row->sales_uom);
else echo '<span class="hikashop_product_price_per_unit">'.JText::_($this->element->sales_uom);

There, you open a span HTML tag, but you don't close it. So you should add a line like this after that piece of code:
echo '</span>';

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

  • graveltravel
10 years 2 months ago #170377

Hi Nicolas,

Thanks for you reply. I found it, and that piece of code is working now ;-)

Just above the previous code there is the section that labels the AT_LEAST_BOUGHT. I se the $this->row->sales_uom to test the sales_uom value for PER_DAY, PER_PERSON and PER_UNIT in order to change the .....AT_LEAST_BOUGHT label. But it's not really working. I guess it has something to do with the $this->row..

Below you'll see the code I'm using. What's wrong?

Many thanks, Eric

if($price->price_min_quantity>1){

/* Original
echo '<span class="hikashop_product_price_per_unit_x">'.JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>'; */

/* Modified by Eric Plugge */
if($this->row->sales_uom == 'PER_DAY'){
echo '<span class="hikashop_product_price_per_unit_x">'.JText::sprintf('PER_DAY_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>';
} else if($this->row->sales_uom == 'PER_PERSON'){
echo '<span class="hikashop_product_price_per_unit_x">'.JText::sprintf('PER_PERSON_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>';
} else
{
echo '<span class="hikashop_product_price_per_unit_x">'.JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>';
}

}

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

  • graveltravel
10 years 2 months ago #170379

SOLVED :-)

In listing_price.php I spelled 'elseif' as 'else if'. Below the working piece of code that takes the sales_uom (unit, day, person) into account.

Kind regards, Eric

if(isset($price->price_min_quantity) && empty($this->cart_product_price) && $this->params->get('per_unit',1)){
if($price->price_min_quantity>1){

/* Original
echo '<span class="hikashop_product_price_per_unit_x">'.JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>'; */

/* Modified by Eric Plugge */
if($this->row->sales_uom == 'PER_DAY'){
echo '<span class="hikashop_product_price_per_unit_x">'.JText::sprintf('PER_DAY_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>';
} elseif($this->row->sales_uom == 'PER_PERSON'){
echo '<span class="hikashop_product_price_per_unit_x">'.JText::sprintf('PER_PERSON_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>';
} else
{
echo '<span class="hikashop_product_price_per_unit_x">'.JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>';
}

}else{

/* echo '<span class="hikashop_product_price_per_unit">'.JText::_('PER_UNIT').'</span>'; */

if(isset($this->element->main)) echo '<span class="hikashop_product_price_per_unit">'.JText::_($this->element->main->sales_uom).'</span>';
elseif(isset($this->row)) echo '<span class="hikashop_product_price_per_unit">'.JText::_($this->row->sales_uom).'</span>';
else echo '<span class="hikashop_product_price_per_unit">'.JText::_($this->element->sales_uom).'</span>';

}
}
if($this->params->get('show_price_weight')){
if(!empty($this->element->product_id) && isset($this->row->product_weight) && bccomp($this->row->product_weight,0,3)){

echo JText::_('PRICE_SEPARATOR').'<span class="hikashop_product_price_per_weight_unit">';
if($this->params->get('price_with_tax')){
$weight_price = $price->price_value_with_tax / $this->row->product_weight;
echo $this->currencyHelper->format($weight_price,$price->price_currency_id).' / '.JText::_($this->row->product_weight_unit);
}
if($this->params->get('price_with_tax')==2){
echo JText::_('PRICE_BEFORE_TAX');
}
if($this->params->get('price_with_tax')==2||!$this->params->get('price_with_tax')){
$weight_price = $price->price_value / $this->row->product_weight;
echo $this->currencyHelper->format($weight_price,$price->price_currency_id).' / '.JText::_($this->row->product_weight_unit);
}
if($this->params->get('price_with_tax')==2){
echo JText::_('PRICE_AFTER_TAX');
}
echo '</span>';
}
}

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

Time to create page: 0.120 seconds
Powered by Kunena Forum