// Exit if accessed directly
}
/**
 * The template to display product attributes on product page or with a shortcode
 *
 * Copy it to your theme implecode folder to edit the output: your-theme-folder-name/implecode/product-attributes.php
 *
 * @version		1.1.2
 * @package		ecommerce-product-catalog/templates/template-parts/product-page
 * @author 		Norbert Dreszer
 */
$single_names = get_single_names();
$product_id = ic_get_product_id();
$attributes_number = product_attributes_number();
$table = '';
if ($attributes_number > 0 && has_product_any_attributes($product_id)) {
    ?>
	<div id="product_features" class="product-features">
		<h3><?php 
    echo $single_names['product_features'];
    ?>
</h3>
		<table class="features-table"><?php 
    for ($i = 1; $i <= $attributes_number; $i++) {
        $attribute_value = get_attribute_value($i, $product_id);
        if (!empty($attribute_value)) {
            ?>
					<tr>
						<td class="attribute-label-single"><?php 
            echo get_attribute_label($i, $product_id);
            ?>
Example #2
0
/**
 * Returns modern grid element for a given product
 *
 * @param object $post Product post object
 * @param string $archive_template
 * @return string
 */
function get_default_archive_theme($post, $archive_template = null)
{
    $archive_template = isset($archive_template) ? $archive_template : get_product_listing_template();
    $return = '';
    if ($archive_template == 'default') {
        $product_id = $post->ID;
        $archive_price = apply_filters('archive_price_filter', '', $post);
        $modern_grid_settings = get_modern_grid_settings();
        $image_id = get_post_thumbnail_id($product_id);
        $thumbnail_product = wp_get_attachment_image_src($image_id, 'modern-grid-listing');
        $product_name = get_the_title();
        if ($thumbnail_product) {
            $url = $thumbnail_product[0];
            $img_class['alt'] = $product_name;
            $img_class['class'] = "modern-grid-image";
            if (!empty($thumbnail_product[2])) {
                $ratio = $thumbnail_product[1] / $thumbnail_product[2];
                if ($ratio <= 1.35 && $ratio > 1.2) {
                    $img_class['class'] .= " higher";
                } else {
                    if ($ratio <= 1.15) {
                        $img_class['class'] .= " higher rect";
                    } else {
                        if ($ratio > 2) {
                            $img_class['class'] .= " wider rect";
                        }
                    }
                }
            }
            $image = wp_get_attachment_image($image_id, 'modern-grid-listing', false, $img_class);
        } else {
            $url = default_product_thumbnail_url();
            $image = '<img class="modern-grid-image" src="' . $url . '" alt="' . $product_name . '">';
        }
        $return = '<div class="al_archive product-' . $product_id . ' modern-grid-element ' . design_schemes('box', 0) . ' ' . product_listing_size_class($thumbnail_product) . ' ' . product_class($product_id) . '">';
        $return .= '<div class="pseudo"></div>';
        $return .= '<a href="' . get_permalink($product_id) . '">' . $image;
        $return .= '<h3 class="product-name ' . design_schemes('box', 0) . '">' . $product_name . '</h3>';
        if ($modern_grid_settings['attributes'] == 1) {
            $attributes_number = product_attributes_number();
            if ($attributes_number > 0 && has_product_any_attributes($product_id)) {
                $return .= '<div class="product-attributes"><table class="attributes-table">';
                for ($i = 1; $i <= $attributes_number; $i++) {
                    $attribute_value = get_attribute_value($i, $product_id);
                    if (!empty($attribute_value)) {
                        $return .= '<tr><td class="attribute-label-listing">' . get_attribute_label($i, $product_id) . '</td><td><span class="attribute-value-listing">' . get_attribute_value($i, $product_id) . '</span> <span class="attribute-unit-listing">' . get_attribute_unit($i, $product_id) . '</span></td></tr>';
                    }
                }
                $return .= '</table></div>';
            }
        }
        $return .= $archive_price . '</a></div>';
    }
    return $return;
}