Displaying "Featured products" or "Recently added products" list in SharePoint site with commerce se
Date : March 29 2020, 07:55 AM
will help you To achive that you could simple run a product search using LastModified field to filter recently created products by date. You'll need to set the catalogs you want to search for, since you said you have to search in all of them. var queryBuilder =
new CommerceQuery<Product, CommerceCatalogFullTextSearchBuilder>();
queryBuilder.SearchCriteria.FullTextSearchType = CommerceFullTextSearchType.FreeText;
queryBuilder.SearchCriteria.Catalogs.Add("MyCatalogName1");
queryBuilder.SearchCriteria.Catalogs.Add("MyCatalogName2");
queryBuilder.SearchCriteria.Catalogs.Add("MyCatalogName3");
queryBuilder.SearchCriteria.WhereClause = "LastModified > '2010-10-01'";
CommerceQueryOperationResponse response =
(CommerceQueryOperationResponse)new OperationServiceAgent()
.ProcessRequest(requestContext, queryBuilder.ToRequest())
.OperationResponses[0];
List<Product> products = new List<Product>();
if (response.CommerceEntities != null && response.CommerceEntities.Count > 0)
{
foreach(var p in response.CommerceEntities)
{
products.Add((Product)p);
}
}
return products;
|
URL SEO for e-commerce website products
Date : March 29 2020, 07:55 AM
this will help I've always been told that you want your key phrase rich URLs as close to the root as possible. To use hyperbole, domain.com/manufacturers/nintendo/products/super-mario-brothers is less effective than domain.com/super-mario-brothers or domain.com/nintendo/super-mario-brothers. With the slashes, I assume you have IIS7. If you don't, you can download the Rewrite Module 2.0, and once installed, click it, then click add rule, there's a module right on the interface for taking care of trailing slashes throughout your solution.
|
Allow duplicate products in woo commerce cart
Date : March 29 2020, 07:55 AM
Any of those help You want to set up Product Variations. EG You may have a T-Shirt that comes in various sizes. The TShirt is the product, however the variations are Large Medium Small. They cann all hold the same SKU or you can modify the SKU for each variant
|
WordPress woo commerce get products by brand
Date : March 29 2020, 07:55 AM
it helps some times In my WordPress project am trying to show products list based on brand name require_once('../wp-load.php');
global $woocommerce;
global $product;
$brand_product_args = array(
'post_type' => 'product',
'posts_per_page' => -1,
'post_status' => 'publish',
'pwb-brand' => 'pbs',
'order' => 'desc',
'orderby' => 'date',
);
$brand_product_list = new WP_Query( $brand_product_args);
while($brand_product_list->have_posts()) : $brand_product_list->the_post();
$product_data = wc_get_product( $post->ID );
endwhile; wp_reset_query();
if(!empty($product_data))
{
$data['status']= true;
$data['product']= $product_data;
}
else
{
$data['status']= false;
$data['product']= array();
}
echo'<pre>'; print_r($data);exit;
echo json_encode($data);
|
Date : March 29 2020, 07:55 AM
I hope this helps you . Maybe this questions already asked but that not helpful for my question. , Finally i creating a code and send the date using API. <?php
require_once('../wp-load.php');
$args = array(
'post_type' => 'product',
'posts_per_page' => -1
);
$brand_product_list = new WP_Query( $args);
$pagination_count = 1;
while($brand_product_list->have_posts()) : $brand_product_list->the_post();
$pagination_count++;
endwhile; wp_reset_query();
//echo'<pre>';print_r($pagination_count/12); exit;
wp_reset_query();
?>
<?php
$pagination = round($pagination_count/12);
for($i=1;$i<=$pagination;$i++)
{
$pagination_no[] = $i;
?>
<!-- <a class="product-category-view-all" href="?pagination=<?php echo $i; ?>"><?php echo $i; ?></a> -->
<?php } ?>
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : $_GET['pagination'];
$args = array(
'post_type' => 'product',
'paged' => $paged,
'posts_per_page' => 12,
);
$wp_query = new WP_Query($args);
while($wp_query->have_posts()) : $wp_query->the_post();
$product_data = wc_get_product( $post->ID );
if(!empty(get_the_post_thumbnail_url($product_data->get_id())))
{
$img = get_the_post_thumbnail_url($product_data->get_id());
}
else
{
$img = "";
}
$product_list[] = array(
'product_id' => $product_data->get_id(),
'product_name' => $product_data->get_title(),
'product_regular_price' => $product_data->get_regular_price(),
'product_sale_price' => $product_data->get_sale_price(),
'product_price' => $product_data->get_price(),
'img' => $img,
'rating' => $product_data->get_average_rating(),
'stock_quantity' => $product_data->get_stock_quantity(),
'stock' => $product_data->is_in_stock(),
);
endwhile; wp_reset_query();
$data[] = array(
'pagination' => $pagination_no,
'product_list' => $product_list
);
//echo json_encode($peoduct_list, $pagination)
echo json_encode($data)
?>
|