{* variables: showtoolbar catalog_view per_row *} {if isset($showtoolbar) && $showtoolbar == 1}
{if !empty($filters)}
{/if} {$catalog_view = waRequest::cookie('catalog_view')} {if !$catalog_view} {$catalog_view = 'grid'} {/if} {$sort_fields = [ 'name' => '[`Name`]', 'price' => '[`Price`]', 'total_sales' => '[`Bestsellers`]', 'rating' => '[`Customer rating`]', 'create_datetime'=>'[`Date added`]', 'stock' => '[`In stock`]' ]} {if !isset($active_sort)} {$active_sort = $wa->get('sort', 'create_datetime')} {/if} {if !empty($sorting)}
[`Sort by`]:
{/if} {* products per page *} {if $theme_settings.show_per_page && $theme_settings.pagination != 'lazyloading'} {$pages_arr = ['12','24','36','48','64']} {$pp_active = waRequest::cookie('products_per_page')} {if !$pp_active} {$pp_active = 12} {/if}
[`Products per page`]:
{else} {/if}
{else} {if !isset($catalog_view)} {$catalog_view = 'grid'} {/if} {/if} {$favList = waRequest::cookie('shop_favorites')} {assign var=favList value=","|explode:$favList} {$skus = $wa->shop->skus(array_keys($products))} {*$images = $wa->shop->images(array_keys($products))*} {* Availability *} {assign var=availability value=[ 'yes' => "[`In stock`]", "no" => "[`Out of stock`]", "preorder" => "[`Pre-order only`]", "unavailable" => "[`Unavailable`]" ]} {if $catalog_view == 'grid' || $catalog_view == 'slider'} {if !(isset($per_row) && $per_row) && (isset($theme_settings.catalog_products_per_row) && $theme_settings.catalog_products_per_row)} {$per_row = $theme_settings.catalog_products_per_row} {else} {$per_row = 4} {/if} {if $theme_settings.catalog_larger_images} {$larger_images = "larger_images"} {else} {$larger_images = ""} {/if}
{if $catalog_view == 'grid'} {if isset($compact) && $compact == true} {$compact = true} {else} {if $theme_settings.catalog_grid_compact} {$compact = true} {else} {$compact = false} {/if} {/if} {else if $catalog_view == 'slider'} {if isset($compact) && $compact == true} {$compact = true} {else} {if $theme_settings.slider_grid_compact} {$compact = true} {else} {$compact = false} {/if} {/if} {/if} {elseif $catalog_view=='list'}
{/if} {foreach $products as $p} {$p.auction = shopAuctionPlugin::isProductAuction($p.id)} {$p.skus = $skus[$p.id]} {*$p.images = $images[$p.id]*} {* Availability *} {$product = $p} {if $product.sku_type} {* selectable skus*} {if $product.count > 1 || $product.count === null} {$availability_text = "[`In stock`]"} {$availability_status = true} {else} {if $wa->shop->settings('ignore_stock_count')} {$availability_text = "[`Pre-order only`]"} {$availability_status = true} {else} {$availability_text = "[`Out of stock`]"} {$availability_status = false} {/if} {/if} {else} {* flat skus*} {$availability_status = false} {if count($product.skus) > 1} {$sku_available = false} {foreach $product.skus as $sku} {$sku_available = $product.status && $sku.available && ($wa->shop->settings('ignore_stock_count') || $sku.count === null || $sku.count > 0)} {$availability_status = $availability_status or $sku_available} {/foreach} {if $product.count > 1 || $product.count === null} {$availability_text = "[`In stock`]"} {$availability_status = true} {else} {if $wa->shop->settings('ignore_stock_count')} {$availability_text = "[`Pre-order only`]"} {$availability_status = true} {else} {$availability_text = "[`Out of stock`]"} {$availability_status = false} {/if} {/if} {else} {$sku = $product.skus[0]} {if !$sku.available} {$availability_text = "[`Unavailable`]"} {elseif !($sku.count === null || $sku.count > 0)} {if $wa->shop->settings('ignore_stock_count')} {$availability_text = "[`Pre-order only`]"} {else} {$availability_text = "[`Out of stock`]"} {/if} {else} {$availability_text = "[`In stock`]"} {/if} {$availability_status = $product.status && $sku.available && ($wa->shop->settings('ignore_stock_count') || $sku.count === null || $sku.count > 0)} {/if} {/if} {* {assign var=thumbs value=[]} {foreach $p.images as $image} {append "thumbs" ["src"=>"{$wa->shop->productImgUrl(['id'=> $image.product_id, 'image_id' => $image.id, 'ext' => $image.ext], '970')}"]} {/foreach} *} {$favClass = ''} {foreach from=$favList item=i} {if $i == $p.id} {$favClass = 'active'} {/if} {/foreach} {if $catalog_view == 'grid' || $catalog_view == 'slider'}
{if isset($remove) && $remove == 1}{/if}
{$p.name}
{if $p.summary}{/if}
1}data-url="{$p.frontend_url}{if strpos($p.frontend_url, '?')}&{else}?{/if}quick_view=1"{/if} method="post" action="{$wa->getUrl('/frontendCart/add')}">
{if $p.compare_price > 0} {shop_currency_html($p.price)} {shop_currency_html($p.compare_price)} {else} {shop_currency_html($p.price)} {/if}
{if !$compact} {if !$theme_settings.disable_reviews} {for $i=1 to 5} {/for} {$p.rating_count} {/if}
{if $p.auction} {else if $availability_status}
{else} {if $theme_settings.catalog_show_stock}
{else} {if isset($availability_text)} {if $availability_text != "[`In stock`]"}
{/if} {/if} {/if} {/if} {if empty($disable_compare) || empty($disable_favorites)}
{if empty($disable_compare)} {/if} {if empty($disable_favorites)} {/if}
{/if}
{/if}
{if isset($availability_text)} {if $theme_settings.catalog_show_stock} {if $p.auction} {else if $availability_text == "[`In stock`]"}
{$availability_text}
{else}
{$availability_text}
{/if} {/if} {/if}
{elseif $catalog_view=='list'}
{if isset($remove) && $remove == 1}{/if}
1}data-url="{$p.frontend_url}{if strpos($p.frontend_url, '?')}&{else}?{/if}quick_view=1"{/if} method="post" action="{$wa->getUrl('/frontendCart/add')}">
{if $p.compare_price > 0} {shop_currency_html($p.price)} {shop_currency_html($p.compare_price)} {else} {shop_currency_html($p.price)} {/if}
{if isset($availability_text)} {if $p.auction} {else if $theme_settings.catalog_show_stock} {if $availability_text == "[`In stock`]"}
{$availability_text}
{else}
{$availability_text}
{/if} {else} {if $availability_text != "[`In stock`]"}
{$availability_text}
{/if} {/if} {/if}
{if $p.auction} {else if $availability_status}
{else} {if $theme_settings.catalog_show_stock}
{/if} {/if} {if empty($disable_compare) || empty($disable_favorites)}
{if empty($disable_compare)} {/if} {if empty($disable_favorites)} {/if}
{/if}
{/if} {/foreach}
{if isset($showpagination) && $showpagination == 1} {if isset($pages_count) && $pages_count > 1}
{wa_pagination total=$pages_count attrs=['class' => "pagination"]}
{/if} {/if}