Skip to content

vadimsva/merlion_import

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

merlion_import

Wordpress плагин для работы с Merlion API

Как использовать:

1. Скопировать файлы в папку plugins/merlion_import, затем активировать плагин в Wordpress

2. В папке с темой, в файл "footer.php" добавить

<script>
var $ = jQuery;
$(function(){

	if (window.location.pathname == '/checkout/order-received/'+$('.order_details .order > strong').text()) {
		var order_ar = [];
		$('.order_info').each(function(){
			order_ar.push({
				sku:$(this).find('> ._sku').text(),
				qty:$(this).find('> ._qty').text(),
				price:$(this).find('> ._price').text()
			});
		});
		$.post(location.origin+'/wp-content/plugins/merlion_import/mli_core.php', {order_products: order_ar}, function(response,status){	});
	}

});
</script>

3. В папке с темой создать папку woocommerce/order и скопировать файл "order-details-item.php" из папки plugins/woocommerce/templates/order, добавить следующие строки внутрь тэга <td class="product-name">

<div class="order_info" style="display:none">
	<span class="_sku"><?php $q = get_post_meta($product->post->ID); echo $q['_sku'][0]; ?></span>
	<span class="_qty"><?php echo $item['qty']; ?></span>
	<span class="_price"><?php echo $item['line_subtotal']/$item['qty']; ?></span>
</div>

4. В панели управления wordpress перейти на страницу Merlion Import и настроить все необходимые параметры