Skip to content

Instantly share code, notes, and snippets.

View ali-cedcoss's full-sized avatar

Ali Rizvi - 1266 ali-cedcoss

View GitHub Profile
@ali-cedcoss
ali-cedcoss / code.md
Last active January 3, 2022 08:26
update stock on ebay using woo webhooks as well as end the product when stock reaches 0
		//product update and order created woo webhooks
		add_action('wp_ajax_ced_ebay_webhook_product_updated_action', array($this, 'ced_ebay_webhook_product_updated_action'));
		add_action('wp_ajax_nopriv_ced_ebay_webhook_product_updated_action', array($this, 'ced_ebay_webhook_product_updated_action'));
		add_action('wp_ajax_nopriv_ced_ebay_webhook_order_created_action', array($this, 'ced_ebay_webhook_order_created_action'));
		add_action('ced_ebay_process_stock_change_webhook', array($this, 'ced_ebay_webhook_update_product_stock'), 10, 1);
@ali-cedcoss
ali-cedcoss / accounts-view-new.php
Last active October 1, 2021 04:42
new accounts settings UI
<?php
// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
die;
}
$file = CED_EBAY_DIRPATH . 'admin/partials/header.php';
if ( file_exists( $file ) ) {
require_once $file;
}
@ali-cedcoss
ali-cedcoss / description-cleaning
Last active October 3, 2021 07:29
mroparts cleaning the eBay description
$doc = new DOMDocument();
$doc->loadHTML($itemDetails['Item']['Description']);
$this->ced_ebay_removeElementsByTagName('style', $doc);
$doc->saveHtml();
$finder = new DomXPath($doc);
$classname="block";
$nodes = $finder->query("//*[contains(concat(' ', normalize-space(@class), ' '), ' $classname ')]");
$tmp_dom = new DOMDocument();
foreach ($nodes as $key=>$node)
@ali-cedcoss
ali-cedcoss / ebay-to-woo-listing-status-sync
Last active March 30, 2022 15:19
syncing listing status from eBay to Woo
```php
//check woo synced product status on eBay
add_action('ced_ebay_check_product_status_on_ebay_action', array($this, 'ced_ebay_check_product_status_on_ebay_callback'));
add_action('wp_ajax_nopriv_ced_ebay_sync_back_ended_listings', array($this, 'ced_ebay_sync_back_ended_listings'));
public function ced_ebay_sync_back_ended_listings(){
@ali-cedcoss
ali-cedcoss / table
Last active October 6, 2021 05:31
kritian plugin table HTML + CSS
<div class="wrap">
<h1>
Failed Orders Details </h1>
<div class="bg-white shadow-2xl rounded-lg mt-3 p-3">
<div class="row">
<div class="flex justify-between items-center">
<input type="text" id="brp_failed_orders_input" class="sticky top-0 inline-block bg-yellow-100 rounded-md text-lg text-bold m-3 py-2 px-4" onkeyup="brp_failed_orders_search()" placeholder="Search for order...">
<h3 class="sticky top-0 inline-block bg-yellow-100 rounded-md text-lg text-bold m-3 py-2 px-4">
Number of failed order(s): 44 </h3>
</div>
@ali-cedcoss
ali-cedcoss / cedRequest.php
Last active October 6, 2021 06:39
ebay api request using wp_remote_post
<?php
class Cedrequest {
public $devID;
public $appID;
public $certID;
public $serverUrl;
public $compatLevel;
public $siteID;
@ali-cedcoss
ali-cedcoss / shipping_template.json
Last active October 6, 2021 13:12
shipping template ebay uk
## Meant only to be used for Sandbox accounts and for eBay UK since we are no longer getting shipping carriers on sandbox.
{"Timestamp":"2021-10-06T13:00:18.412Z","Ack":"Success","Version":"1201","Build":"E1201_CORE_API6_19110890_R1","ShippingServiceDetails":[{"Description":"RM Return Service","ShippingService":"UK_RMReturnService","ShippingServiceID":"342","ShippingTimeMax":"1","ShippingTimeMin":"1","ValidForSellingFlow":"false","ShippingCarrier":"RoyalMail","DetailVersion":"525","UpdateTime":"2021-09-25T16:00:02.000Z","ShippingCategory":"NONE"},{"Description":"PF Return Service","ShippingService":"UK_PFReturnService","ShippingServiceID":"343","ShippingTimeMax":"1","ShippingTimeMin":"1","ValidForSellingFlow":"false","ShippingCarrier":"Parcelforce","DetailVersion":"525","UpdateTime":"2021-09-25T16:00:02.000Z","ShippingCategory":"NONE"},{"Description":"International Priority Shipping","InternationalService":"true","ShippingService":"InternationalPriorityShippingUK","ShippingServiceID":"50300","ShippingTimeMa
@ali-cedcoss
ali-cedcoss / code.md
Last active December 28, 2021 10:15
woo to ebay bulk stock sync

Syncing stock levels from Woo to eBay in Bulk by picking up all the products marked uploaded and scheduling a single action for each product and sending them to eBay for the update.


		//check woo synced product status on eBay
		add_action('ced_ebay_bulk_sync_stock_and_price', array($this, 'ced_ebay_bulk_sync_stock_and_price_callback'));
@ali-cedcoss
ali-cedcoss / response.md
Created October 7, 2021 11:45
powerbody error and success response
<br />

Deprecated: Unparenthesized a ? b : c ? d : e is deprecated. Use either (a ? b : c) ? d : e or a ? b : (c ? d : e) in /home/uktsg/public_html/wp-content/plugins/woocommerce-fruugo-integration/admin/helper/class-product-fields.php on line 678

Deprecated: Unparenthesized a ? b : c ? d : e is deprecated. Use either (a ? b : c) ? d : e or a ? b : (c ? d : e) in /home/uktsg/public_html/wp-content/plugins/woocommerce-fruugo-integration/admin/helper/class-product-fields.php on line 686

Deprecated: Unparenthesized a ? b : c ? d : e is deprecated. Use either (a ? b : c) ? d : e or a ? b : (c ? d : e) in /home/uktsg/public_html/wp-content/plugins/woocommerce-fruugo-integration/admin/helper/class-product-fields.php on line 702

Deprecated: Unparenthesized a ? b : c ? d : e is deprecated. Use either (a ? b : c) ? d : e or a ? b : (c ? d : e) in /home/uktsg/public_html/wp-conte

@ali-cedcoss
ali-cedcoss / code.php
Last active October 12, 2021 12:59
ebay to woo price sync
//Run the existing product sync first to make sure that the eBay listings are synced on WooCommerce. Then run this code to sync the price of products from eBay to Woo.
add_action('ced_ebay_sync_price_to_woo_action', array($this, 'ced_ebay_sync_price_to_woo_action_cb'));
add_action('wp_ajax_nopriv_ced_ebay_sync_price_from_ebay_to_woo', array($this, 'ced_ebay_sync_price_from_ebay_to_woo'));
public function ced_ebay_sync_price_from_ebay_to_woo(){
$logger = wc_get_logger();