예제 #1
0
파일: tags.php 프로젝트: Inteleck/hwc
function lightspeed_tag_cloud($atts)
{
    // include our handy API wrapper that makes it easy to call the API, it also depends on MOScURL to make the cURL call
    require_once "MOSAPICall.class.php";
    extract(shortcode_atts(array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => false), $atts));
    ob_start();
    $mosapi = new MOSAPICall("992e498dfa5ab5245f5bd5afee4ee1ce6ac6e0a1ee7d11e36480694a9b5282e7", "83442");
    $emitter = 'https://api.merchantos.com/API/Account/83442/Tag';
    $xml_query_string = 'limit=100&orderby=' . $orderby . '&orderby_asc=1';
    $terms = $mosapi->makeAPICall("Account.Tag", "Read", null, null, $emitter, $xml_query_string);
    ?>
	<div id="tag_cloud-3" class="widget widget_tag_cloud">
		<h3 class="widget-title">Tags</h3>
		<div class="tagcloud">
			<?php 
    foreach ($terms as $term) {
        $slug = sanitize_title($term->name);
        $tag = $term->name;
        ?>
				<a href="http://borealpaddle.lightspeedwebstore.com/<?php 
        echo $slug;
        ?>
" target="_black"><?php 
        echo $tag;
        ?>
</a>
				<?php 
    }
    ?>
		</div>
	</div>

	<?php 
    return ob_get_clean();
}
예제 #2
0
function new_products_lightspeed($atts)
{
    /**
     * Featured Products shortcode
     *
     * @param array $atts
     * @return string
     */
    global $woocommerce_loop, $products, $product;
    // include our handy API wrapper that makes it easy to call the API, it also depends on MOScURL to make the cURL call
    require_once "MOSAPICall.class.php";
    extract(shortcode_atts(array('per_page' => '12', 'columns' => '4', 'orderby' => 'date', 'order' => 'desc'), $atts));
    $woocommerce_loop['columns'] = $columns;
    ob_start();
    $mosapi = new MOSAPICall("992e498dfa5ab5245f5bd5afee4ee1ce6ac6e0a1ee7d11e36480694a9b5282e7", "83442");
    $emitter = 'https://api.merchantos.com/API/Account/83442/ItemMatrix';
    $xml_query_string = 'limit=100&orderby=timeStamp&orderby_desc=1&load_relations=["ItemECommerce","Tags","Images"]';
    $products = $mosapi->makeAPICall("Account.ItemMatrix", "Read", null, null, $emitter, $xml_query_string);
    $wp_session = WP_Session::get_instance();
    $products = xml2array($products);
    $wp_session['products'] = $products;
    //var_dump($wp_session['products']);
    $i = 0;
    //if ( $products->children() ) :
    ?>

		<?php 
    woocommerce_product_loop_start();
    ?>

			<?php 
    foreach ($products as $prod) {
        foreach ($prod as $product) {
            wc_get_template_part('content', 'lightspeedproduct');
        }
    }
    // end of the loop.
    ?>

		<?php 
    woocommerce_product_loop_end();
    ?>

	<?php 
    //endif;
    return '<div class="woocommerce columns-' . $columns . '">' . ob_get_clean() . '</div>';
}
예제 #3
0
파일: categories.php 프로젝트: Inteleck/hwc
<?php

// include our handy API wrapper that makes it easy to call the API, it also depends on MOScURL to make the cURL call
require_once "MOSAPICall.class.php";
// setup our credentials
// this key is to our demo data and allows full access to just /Account/797/Item control
$mosapi = new MOSAPICall("992e498dfa5ab5245f5bd5afee4ee1ce6ac6e0a1ee7d11e36480694a9b5282e7", "83442");
// get the itemID out of the response XML
// $item_id = $item_response_xml->itemID;
// $matrix_id = $item_response_xml->itemMatrixID;
// $tag_id = $item_response_xml->tagID;
//$emitter = "https://api.merchantos.com/API/Account/$account_id/ItemMatrix?limit=200\&load_relations=all\&tag=beyondyoga";
$emitter = 'https://api.merchantos.com/API/Account/83442/ItemMatrix?limit=500\\&load_relations=["ItemECommerce","Tags","Images"]';
//$xml_query_string = "nodeDepth=0&categoryID=";
// make another API call to Account.Item, this time with Update method and our changed Item XML.
//$get_items = $mosapi->makeAPICall("Account.Item","Read",$item_id,null,$emitter, $xml_query_string);
//$get_matrix = $mosapi->makeAPICall("Account.ItemMatrix","Read",$matrix_id,null);
$matrixs = $mosapi->makeAPICall("Account.ItemMatrix", "Read", null, null, $emitter);
//$get_tags = $mosapi->makeAPICall("Account.Tag","Read",$tag_id,null);
//print_r($get_items);
//print_r($matrixs);
//print_r($get_tags);
// output everything
function api_call()
{
    global $matrixs, $mosapi;
    foreach ($matrixs as $item) {
        print_r($item);
        // 		$id = $item->itemMatrixID;
        $name = $item->description;
        // 		$tax = $item->tax;