This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Set relative product URLs | |
foreach ($products as &$product) { | |
$url = "&product_id={$product['id']}"; | |
$name = explode(" -- ", $product['name']); // like: Chocolates -- 587 | |
$url .= "&name={$name[0]}"; | |
if ($name[1] != "") { | |
$name[1] = str_pad($name[1], 8, "0", STR_PAD_LEFT); // format as 00000587 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$arr = array(); | |
if ($arr[0] == false) { | |
echo "Yay"; | |
} else { | |
echo "Boo"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function startElement($name) { | |
global $n, $data_array, $message_type; | |
if (in_array($name, $message_type)) { | |
$data_array[$n] = "{$name}||"; | |
} else { | |
$data_array[$n] = (!empty($data_array[$n]) ? $data_array[$n] : '') . "[{$name}||"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function startElement($name) { | |
global $n, $data_array, $message_type; | |
if (in_array($name, $message_type)) { | |
$data_array[$n] = $name . "||"; | |
} else { | |
$data_array[$n] .= "[".$name."||"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function exchange_send_message_raw($context, $content) | |
{ | |
$location = "https://test.cotten.io/exchange/raw_message.php"; | |
$request = array('direction' => 1, // outgoing | |
'context' => $context, | |
'content' => json_encode($content)); | |
$message = null; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function exchange_send_message_raw($context, $content) | |
{ | |
$location = "https://test.cotten.io/exchange/raw_message.php"; | |
$request = array('direction' => 1, // outgoing | |
'context' => $context, | |
'content' => json_encode($content)); | |
$response = ProxyPostClient::request($location, $request); | |
$response_obj = json_decode($response); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Exclude orders that are drop-ship products from store lookups | |
if ($order->product->type == PRODUCT::TYPE_DROPSHIP) { | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Order structure example | |
Order Object | |
( | |
[id] => 44274002 | |
[delivery_date] => 2021–03–05 | |
[delivery_location_type] => Home | |
[occasion] => Just Because | |
[fulfillment_type] => 3 | |
[fulfillment_location] => 12 | |
[product] => Product Object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Exclude orders with drop-ship items from store lookups | |
foreach ($order->product as $_product) { | |
if ($_product->type == PRODUCT::TYPE_DROPSHIP) { | |
return false; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ... Missile Command API called ... | |
$api_result = "{launch_verification:false,msg:'abort'}"; | |
$result = json_decode($api_result); | |
if (isset($result->launch_verification) && $result->launch_verification == true) { | |
echo "Launching nuclear missiles."; | |
launch_missiles(); | |
exit(); |