Parts of custom show_default view dissapear

  • Posts: 39
  • Thank you received: 0
10 years 7 months ago #188857

-- HikaShop version -- : 2.3.5
-- Joomla version -- : 3.2.4
-- PHP version -- : 5.4.32
-- Browser(s) name and version -- : Opera 27

I am working on a dev server in a private network atm so am unable to provide a link. But i have details and screenshots.

I have a number of customised views in my template html folder.

listing_img_title => I need to display my products in a modal (fancybox) window. I also only need only the joomla component to display inside the window, not the entire template, so I added ?tmpl=modalcomponent to the end of the image and product name links on lines 46 & 85 resulting in <a class="fancybox" href="<?php echo $link;?>?tmpl=modalcomponent". This works fine.

show_defaultgymwear => I have a number of product categories one of which (gymwear) needs a unique product layouts. So I have created a gymwear view which I assign to the products in product parameters.

show_block_img_gymwear => the gymwear products need to show images differently to other products (hikashop_small_image_div needs to be on right hand side of hikashop_main_image_div)

The gymwear products also have three size characteristics assigned to them.

The problem is: if I assign the gymwear product view to a gymwear product, open it in the modal window, then select a size characteristic everything except the product images and product title dissapear and the show_block_img_gymwear view changes to the show_block_img used for other products. Everything works fine if I do not assign the gymwear product view to product. Attached screenshots illustrate the problem.

For testing I also created gymwear specific views for characteristics and qauntity and assigned labels to them GM CHAR BLOCK
,M GM Q BLOCK, and GM IMAGE BLOCK and I assigned a label (GM DEFAULT) to the gymwear product view so I can what see which part/s changes to the incorrect view/s. As mentioned above it appears that the gymwear block_image changes to the generic block_image.

I have also attached the gymwear product and image view and the rendered html before after the things dissapear. I am not aware of any error messages that are generated by this problem.

Last edit: 10 years 7 months ago by dda. Reason: attachment edit

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
10 years 7 months ago #188982

Hi,

When you are using characteristics, the images can be replaced when you select a variant.
That's why there is a javascript event which allow to reprocess the lightbox links for the integration with shadbowbox.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 39
  • Thank you received: 0
10 years 7 months ago #189009

ok I have temporarily removed the fancybox activator from images and titles on product listing page view. The dissapearing problem still persists when I use the gymwear specific show_defaultgymwear view. I noticed that I am getting a javascript error (see below error appears towards bottom). I am getting this error regardless of whether I use the my main custom show_default (but the problem does not happen) ( or the show_defaultgymwear. Is this error related to the problem?

Uncaught TypeError: undefined is not a function

<!--
var hikashopFieldsJs=Array();
			hikashopFieldsJs['reqFieldsComp']=Array();
			hikashopFieldsJs['validFieldsComp']=Array();
//-->

<!--

			function hikashopToggleFields(new_value,namekey,field_type,id,prefix){
				var arr = new Array();
				var checked = 0;
				arr = document.getElementsByName('data['+field_type+']['+namekey+'][]');
				if(typeof arr[0] != 'undefined' && typeof arr[0].length != 'undefined'){
					var size = arr[0].length;
				}else{
					var size = arr.length;
				}
				if(prefix === undefined || !prefix || prefix.length == 0 || prefix.substr(-1) != '_')
					prefix = 'hikashop_';
				for(var c = 0; c < size; c++){
					if(typeof arr[0] != 'undefined' && typeof arr[0].length != 'undefined'){
						var obj = document.getElementsByName('data['+field_type+']['+namekey+'][]').item(0).item(c);
					}else{
						var obj = document.getElementsByName('data['+field_type+']['+namekey+'][]').item(c);
					}
					if((typeof obj.checked != 'undefined' && obj.checked) || (typeof obj.selected != 'undefined' && obj.selected)){
						checked++;
					}
					if((typeof obj.type != 'undefined' && obj.type=='checkbox')){
						var specialField = true;
					}
				}
				var checkedGood = 0;
				var count = 0;
				if(typeof hikashopFieldsJs != 'undefined' && typeof hikashopFieldsJs[field_type] != 'undefined'){
					for(var k in hikashopFieldsJs[field_type][namekey]) {
						if(typeof hikashopFieldsJs[field_type][namekey][k] == 'object'){
							for(var l in hikashopFieldsJs[field_type][namekey][k]){
								if(typeof hikashopFieldsJs[field_type][namekey][k][l] == 'string'){
									count++;
									newEl = document.getElementById(namekey+'_'+k);
									if(newEl && ((typeof newEl.checked != 'undefined' && newEl.checked) || (typeof newEl.selected != 'undefined' && newEl.selected))){
										checkedGood++;
									}
								}
							}
						}
					}
				}
				if(typeof arr[0] != 'undefined' && typeof arr[0].length != 'undefined' && count>1){
					var specialField = true;
				}
				if(typeof hikashopFieldsJs != 'undefined' && typeof hikashopFieldsJs[field_type] != 'undefined'){
					for(var j in hikashopFieldsJs[field_type][namekey]) {
						if(typeof hikashopFieldsJs[field_type][namekey][j] == 'object'){
							for(var i in hikashopFieldsJs[field_type][namekey][j]){
								if(typeof hikashopFieldsJs[field_type][namekey][j][i] == 'string'){
									var elementName = prefix+field_type+'_'+hikashopFieldsJs[field_type][namekey][j][i];
									if(id){
										elementName = elementName + '_' + id;
									}
									el = document.getElementById(elementName);
									if(!el) continue;
									if(specialField){
										if(checkedGood==count && checkedGood==checked && new_value!=''){
											el.style.display='';
											hikashopToggleFields(el.value,hikashopFieldsJs[field_type][namekey][j][i],field_type,id,prefix);
										}else{
											el.style.display='none';
											hikashopToggleFields('',hikashopFieldsJs[field_type][namekey][j][i],field_type,id,prefix);
										}
									}else{
										if(j==new_value){
											el.style.display='';
											hikashopToggleFields(el.value,hikashopFieldsJs[field_type][namekey][j][i],field_type,id,prefix);
										}else{
											el.style.display='none';
											hikashopToggleFields('',hikashopFieldsJs[field_type][namekey][j][i],field_type,id,prefix);
										}
									}
								}
							}
						}
					}
				}
			} ****ERROR FLAGGED HERE*****
//-->
****OR ERROR FLAGGED HERE*****
		do_nothing( function() {

			SqueezeBox.initialize({});
			SqueezeBox.assign($$('a.modal'), {
				parse: 'rel'
			});
		});
<!--

Last edit: 10 years 7 months ago by Jerome. Reason: [code] is nice !

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

  • Posts: 84304
  • Thank you received: 13698
  • MODERATOR
10 years 7 months ago #189058

Hi,

The message from Jerome was apparently not clear enough.
When a product has characteristics, the characteristic system will dynamically replace the elements on the page for each different variant.
The data of each variant is add to the product page by the file "show" of the view "product". There, the images of each variant are also loaded calling the "show_block_img" view file.
So it's normal that you get the show_block_img layout used for the display of the image after you select a characteristic if you only changed the call to show_block_img in the show_defaultgymwear view file. You should also modify the show file to take that into change into account their. If you always have the same image displayed regardless of the variant selected, then simply remove the image display code in the show view file and the characteristic system won't swap the default image with the variant one when you change the characteristic selection.

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

  • Posts: 39
  • Thank you received: 0
10 years 7 months ago #189112

Thanks for adding more info.

In show_blockgymwear i am calling show_block_img_gymwear with the line $this->setLayout('show_block_img_gymwear');

Are you saying that I need to change something in show_block_img_gymwear to call show_blockgymwear after a variant change?

Each variant has multiple images assigned to it so I need to conserve the image swapping functionality.

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

  • Posts: 84304
  • Thank you received: 13698
  • MODERATOR
10 years 7 months ago #189146

No. You should call show_block_img_gymwear instead of show_block_img in the "show" view file as that's where the images are generated for the variants of the product.

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

Time to create page: 0.064 seconds
Powered by Kunena Forum