How to disabhle the modal when changing the layout?

Posted almost 2 years by Danny de Kruijk

Post a topic
Answered
D
Danny de Kruijk

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!

0 Votes

D

Danny de Kruijk posted almost 2 years 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();

};

 


0 Votes


3 Comments

Sorted by
M

Miran posted 9 months

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

Thank you.

0 Votes

R

Rhiannon Doyle posted almost 2 years Admin

Thanks for sharing Danny! 


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

0 Votes

D

Danny de Kruijk posted almost 2 years 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();

};

 


0 Votes

Login or Sign up to post a comment