How to disabhle the modal when changing the layout?

Posted about 3 years ago 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 about 3 years ago 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


4 Comments

Sorted by
D

Dimitris Mourtzis posted 29 days ago

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?

0 Votes

M

Miran posted about 2 years ago

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

Thank you.

0 Votes

R

Rhiannon Doyle posted about 3 years ago 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 about 3 years ago 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