radykal | Support Center Chooser

For which product do you need support?

Fancy Product Designer Multistep Product Configurator

Start a new topic
Answered

How to disabhle the modal when changing the layout?

I use MSCP to change the layout of the product. Each time, there is a modal to confirm to replace all the elements. I can't find to disable the specific modal, only the modal for 'swapping products' can be disabled, but this doesn't affect the layout change.

Is there a way to disable the 'layout' change modal? 

Thanks!


Best Answer

Found and changed it in the JS eventually. It's a little bit nasty, so a toggle in an update would be nice :) 
For anyone with the same issue, change the code to the following in the FancyProductDesigner-all.js. Don't forget to minify it after and replace the .min version on the server!


   

$scrollArea.on('click', '.fpd-item', function() {

			if(fpdInstance.productCreated) {

				var $confirm = true,
					layoutIndex = $scrollArea.find('.fpd-item').index($(this));

					_layoutElementLoadingIndex = 0;

					var $viewInstance = $(fpdInstance.currentViewInstance);

					_totalLayoutElements = currentLayouts[layoutIndex].elements.length;

					fpdInstance.globalCustomElements = [];
					if(fpdInstance.mainOptions.replaceInitialElements) {
						fpdInstance.globalCustomElements = fpdInstance.getCustomElements();
					}

					$viewInstance.on('beforeElementAdd', _loadingLayoutElement);

					fpdInstance.toggleSpinner(true);
					fpdInstance.currentViewInstance.loadElements(currentLayouts[layoutIndex].elements, function() {

						fpdInstance.toggleSpinner(false);
						$viewInstance.off('beforeElementAdd', _loadingLayoutElement);

						/**
						 * Gets fired when a all elements of layout are added.
						 *
						 * @event FancyProductDesigner#productAdd
						 * @param {Event} event
						 * @param {Array} elements - Added elements.
						 */
						fpdInstance.$container.trigger('layoutElementsAdded', [currentLayouts[layoutIndex].elements]);

					});

					fpdInstance.$viewSelectionWrapper.find('.fpd-item').eq(fpdInstance.currentViewIndex).children('picture').css('background-image', 'url('+currentLayouts[layoutIndex].thumbnail+')');
			}

		});

	};

	_initialize();

};

 



Answer

Found and changed it in the JS eventually. It's a little bit nasty, so a toggle in an update would be nice :) 
For anyone with the same issue, change the code to the following in the FancyProductDesigner-all.js. Don't forget to minify it after and replace the .min version on the server!


   

$scrollArea.on('click', '.fpd-item', function() {

			if(fpdInstance.productCreated) {

				var $confirm = true,
					layoutIndex = $scrollArea.find('.fpd-item').index($(this));

					_layoutElementLoadingIndex = 0;

					var $viewInstance = $(fpdInstance.currentViewInstance);

					_totalLayoutElements = currentLayouts[layoutIndex].elements.length;

					fpdInstance.globalCustomElements = [];
					if(fpdInstance.mainOptions.replaceInitialElements) {
						fpdInstance.globalCustomElements = fpdInstance.getCustomElements();
					}

					$viewInstance.on('beforeElementAdd', _loadingLayoutElement);

					fpdInstance.toggleSpinner(true);
					fpdInstance.currentViewInstance.loadElements(currentLayouts[layoutIndex].elements, function() {

						fpdInstance.toggleSpinner(false);
						$viewInstance.off('beforeElementAdd', _loadingLayoutElement);

						/**
						 * Gets fired when a all elements of layout are added.
						 *
						 * @event FancyProductDesigner#productAdd
						 * @param {Event} event
						 * @param {Array} elements - Added elements.
						 */
						fpdInstance.$container.trigger('layoutElementsAdded', [currentLayouts[layoutIndex].elements]);

					});

					fpdInstance.$viewSelectionWrapper.find('.fpd-item').eq(fpdInstance.currentViewIndex).children('picture').css('background-image', 'url('+currentLayouts[layoutIndex].thumbnail+')');
			}

		});

	};

	_initialize();

};

 


Thanks for sharing Danny! 


Little reminder to anyone who customises the core... you'll need to do this every time you update the plugin.

Please include option in settings to disable confirmation popup on changing layouts. 

Thank you.

I am trying to do the same thing but I cannot find what to replace.

Does this still work with current version of the plugin?

Login or Signup to post a comment