cdek widget

https://widget.cdek.ru/

Логин и пароль от кабинета — это номер договора и ИНН, пароль следует поменять.

библиотеки виджета

<script id="ISDEKscript" type="text/javascript" src="widget/widjet.js"></script>
<script type="text/javascript" src="sdek.js"></script>

js код виджета

	var weight_sum = window.weight.reduce((a, b) => a + b, 0)
    setTimeout(function(){
    	var widjet = new ISDEKWidjet({
    		hideMessages: false,
    		defaultCity: 'Москва',
    		cityFrom: 'Москва',
    		country: 'Россия',
    		choose: true,
    		link: 'forpvz',
            servicepath: '/widget/scripts/service.php',
            // path: 'https://www.cdek.ru/website/edostavka/template/scripts/',
            hidedress: false,
            bymapcoord: false,
            hidecash: false,
            hidedelt: false,
    		goods: [{
    			length: 10,
    			width: 10,
    			height: 10,
    			weight: weight_sum
    		}],
    		onReady: onReady,
    		onChoose: onChoose,
    		onChooseProfile: onChooseProfile,
    		onCalculate: onCalculate
    	});
    }, 4000)

    window.sdekData = {}
    sdekData.goods = window.products
    sdekData.weight_sum = window.weight_sum

	function onReady() {
		console.log('ready');
	}

	function onChoose(wat) {
		console.log('chosen', wat);
		$.extend(sdekData, wat)
        sdekData.PVZ = true 
		console.log(sdekData)
        $('.delivery-selected').show()
	}

	function onChooseProfile(wat) {
		console.log('chosenCourier', wat);
		$.extend(sdekData, wat)
		console.log(sdekData)
        sdekData.PVZ = false
        $('.delivery-selected').show()
	}

	function onCalculate(wat) {
		console.log('calculated', wat);
	}

Leave a comment

Your email address will not be published.


*