/** * WPSC canonical URL function * Needs a recent version * @since 3.7 * @param int product id * @return bool true or false */ function wpsc_change_canonical_url($url) { global $wpdb, $wpsc_query, $post; // Only change the URL is we're viewing a WP e-Commerce page if (stristr($post->post_content, '[productspage]')) { if (isset($wpsc_query->query_vars['product_url_name'])) { $product_url_name = $wpsc_query->query_vars['product_url_name']; } else { $product_url_name = ''; } // Viewing a single product page if ($product_url_name != '') { if (!is_numeric($_GET['product_id'])) { $product_id = $wpdb->get_var($wpdb->prepare("SELECT product_id FROM " . WPSC_TABLE_PRODUCTMETA . " WHERE meta_key = 'url_name' AND meta_value = %s ORDER BY product_id DESC LIMIT 1", $product_url_name)); } else { $product_id = absint($_GET['product_id']); } if ($product_id > 0) { $url = wpsc_product_url($product_id); } else { $url = get_option('product_list_url'); } // Viewing a category page } elseif (absint($wpsc_query->query_vars['category_id']) > 0) { $url = wpsc_category_url(absint($wpsc_query->query_vars['category_id'])); if ($wpsc_query->query_vars['page'] > 1) { if (get_option('permalink_structure')) { $url .= "page/{$wpsc_query->query_vars['page']}/"; } else { $url .= "&page_number={$wpsc_query->query_vars['page']}"; $url = html_entity_decode($url); } } } } return $url; }
function wpsc_product_url($product_id, $category_id = null, $escape = true) { global $wpdb, $wp_rewrite, $wp_query; if (!is_numeric($category_id) || $category_id < 1) { if (is_numeric($wp_query->query_vars['product_category'])) { $category_id = $wp_query->query_vars['product_category']; } else { $category_list = $wpdb->get_row("SELECT `" . WPSC_TABLE_PRODUCT_CATEGORIES . "`.`id`, IF((`" . WPSC_TABLE_PRODUCT_CATEGORIES . "`.`id` = '" . get_option('wpsc_default_category') . "'), 0, 1) AS `order_state` FROM `" . WPSC_TABLE_ITEM_CATEGORY_ASSOC . "` , `" . WPSC_TABLE_PRODUCT_CATEGORIES . "` WHERE `" . WPSC_TABLE_ITEM_CATEGORY_ASSOC . "`.`product_id` IN ('" . $product_id . "') AND `" . WPSC_TABLE_ITEM_CATEGORY_ASSOC . "`.`category_id` = `" . WPSC_TABLE_PRODUCT_CATEGORIES . "`.`id` AND `" . WPSC_TABLE_PRODUCT_CATEGORIES . "`.`active` IN('1') LIMIT 1", ARRAY_A); $category_id = $category_list['id']; } } if ($wp_rewrite->rules != null && $wp_rewrite != null || get_option('rewrite_rules') != null) { $url_name = get_product_meta($product_id, 'url_name', true); $url_name = htmlentities(stripslashes($url_name), ENT_QUOTES, 'UTF-8'); $product_url = wpsc_category_url($category_id) . $url_name . "/"; } else { if (!stristr(get_option('product_list_url'), "?")) { $initial_seperator = "?"; } else { $initial_seperator = $escape ? "&" : "&"; } if (is_numeric($category_id) && $category_id > 0) { $product_url = get_option('product_list_url') . $initial_seperator . "category=" . $category_id . ($escape ? "&" : "&") . "product_id=" . $product_id; } else { $product_url = get_option('product_list_url') . $initial_seperator . "product_id=" . $product_id; } } return $product_url; }
/** * this page url function, returns the URL of this page * @return string - the URL of the current page */ function wpsc_this_page_url() { global $wpsc_query, $wp_query; if ($wpsc_query->is_single === true) { $output = wpsc_product_url($wp_query->post->ID); } else { if (isset($wpsc_query->category) && $wpsc_query->category != null) { $output = wpsc_category_url($wpsc_query->category); if ($wpsc_query->query_vars['page'] > 1) { if (get_option('permalink_structure')) { $output .= "page/{$wpsc_query->query_vars['page']}/"; } else { $output = add_query_arg('page_number', $wpsc_query->query_vars['page'], $output); } } } elseif (isset($id)) { $output = get_permalink($id); } else { $output = get_permalink(get_the_ID()); } } return $output; }
/** * WPSC canonical URL function * Needs a recent version * @since 3.7 * @param int product id * @return bool true or false */ function wpsc_change_canonical_url($url) { global $wpdb, $wpsc_query; if ($wpsc_query->is_single == true) { if (!is_numeric($_GET['product_id'])) { $product_id = $wpdb->get_var("SELECT `product_id` FROM `" . WPSC_TABLE_PRODUCTMETA . "` WHERE `meta_key` IN ( 'url_name' ) AND `meta_value` IN ( '" . $wpsc_query->query_vars['product_url_name'] . "' ) ORDER BY `product_id` DESC LIMIT 1"); } else { $product_id = absint($_GET['product_id']); } $url = wpsc_product_url($product_id); } else { if ($wpsc_query->query_vars['category_id'] > 0) { $url = wpsc_category_url($wpsc_query->query_vars['category_id']); if (get_option('permalink_structure') && $wpsc_query->query_vars['page'] > 1) { $url .= $url . "page/{$wpsc_query->query_vars['page']}/"; } } } return $url; }
function get_breadcrumbs() { global $wpdb; $this->breadcrumbs = array(); $i = 0; if ($this->category != null) { if ($this->is_single == true) { $this->breadcrumbs[$i]['name'] = htmlentities(stripslashes($this->product['name']), ENT_QUOTES, 'UTF-8'); $this->breadcrumbs[$i]['url'] = ''; $i++; } $category_info = $wpdb->get_row("SELECT * FROM " . WPSC_TABLE_PRODUCT_CATEGORIES . " WHERE id='" . (int) $this->category . "'", ARRAY_A); $this->breadcrumbs[$i]['id'] = $category_info['id']; $this->breadcrumbs[$i]['name'] = $category_info['name']; if ($i > 0) { $this->breadcrumbs[$i]['url'] = wpsc_category_url($category_info['id']); } else { $this->breadcrumbs[$i]['url'] = ''; } $i++; while ($category_info['category_parent'] != 0) { $category_info = $wpdb->get_row("SELECT * FROM " . WPSC_TABLE_PRODUCT_CATEGORIES . " WHERE id='{$category_info['category_parent']}'", ARRAY_A); $this->breadcrumbs[$i]['id'] = $category_info['id']; $this->breadcrumbs[$i]['name'] = htmlentities(stripslashes($category_info['name']), ENT_QUOTES, 'UTF-8'); $this->breadcrumbs[$i]['url'] = wpsc_category_url($category_info['id']); $i++; } } $this->breadcrumbs = array_reverse($this->breadcrumbs); $this->breadcrumb_count = count($this->breadcrumbs); }
function show_cats_brands($category_group = null, $display_method = null, $order_by = 'name', $image = null) { global $wpdb; if ($category_group == null) { $category_group = $wpdb->get_var("SELECT `id` FROM `" . WPSC_TABLE_CATEGORISATION_GROUPS . "` WHERE `active` IN ('1') AND `default` IN ('1') LIMIT 1 "); } else { $category_group = (int) $category_group; } // Show cats & brands list if displaying on every page or if on a shop page (bit hacky but out of time). if (get_option('cat_brand_loc') != 3 && !function_exists("nzshpcrt_display_categories_groups") && $display_method != 'sidebar') { return; } if (get_option('permalink_structure') != '') { $seperator = "?"; } else { $seperator = "&"; } $output = "<div class='PeSwitcher'>"; switch (get_option('show_categorybrands')) { case 1: $output .= "<ul id='PeCatsBrandsBoth' class='category_brand_header'><li id='PeSwitcherFirst'><a href='' onclick='return prodgroupswitch(\"categories\");'>" . TXT_WPSC_CATEGORIES . "</a> | <a href='' onclick='return prodgroupswitch(\"brands\");'>" . TXT_WPSC_BRANDS . "</a></li></ul>"; break; } $output .= "</div>"; $output .= "<div class='PeCatsBrands'>"; if (get_option('show_categorybrands') == 1 || get_option('show_categorybrands') == 2) { $output .= "<div class='PeCategories categorydisplay'>"; $categories = $wpdb->get_results("SELECT * FROM `" . WPSC_TABLE_PRODUCT_CATEGORIES . "` WHERE `group_id` IN ('{$category_group}') AND `active`='1' AND `category_parent` = '0' ORDER BY `" . $wpdb->escape($order_by) . "` ASC", ARRAY_A); if ($categories != null) { $output .= "<ul class='PeCategories'>"; foreach ($categories as $option) { // Adrian - check option for category count if (get_option('show_category_count') == 1) { //show product count for each category $count = $wpdb->get_var("SELECT COUNT(`p`.`id`) FROM `" . WPSC_TABLE_ITEM_CATEGORY_ASSOC . "` AS `a` JOIN `" . WPSC_TABLE_PRODUCT_LIST . "` AS `p` ON `a`.`product_id` = `p`.`id` WHERE `a`.`category_id` IN ('{$option['id']}') AND `p`.`active` IN ('1')"); $addCount = " (" . $count . ")"; } //end get_option // No more mootools if (get_option('catsprods_display_type') == 1) { $output .= "<li class='cat-item'><span class='category'><a class='productlink' href='" . wpsc_category_url($option['id']) . "'>" . stripslashes($option['name']) . "</a>" . $addCount . "</span>"; } else { // Adrian - otherwise create normal category text with or without product count if (!$image) { $output .= "<li class='cat-item'><span class='category'><a class='productlink' href='" . wpsc_category_url($option['id']) . "'>" . stripslashes($option['name']) . "</a>" . $addCount . "</span>"; } else { $output .= "<li class='cat-item'><img src='" . WPSC_CATEGORY_URL . $option['image'] . "'><br><span class='category'><a class='productlink' href='" . wpsc_category_url($option['id']) . "'>" . stripslashes($option['name']) . "</a>" . $addCount . "</span>"; } } //end get_option $subcategory_sql = "SELECT * FROM `" . WPSC_TABLE_PRODUCT_CATEGORIES . "` WHERE `group_id` IN ('{$category_group}') AND `active`='1' AND `category_parent` = '" . $option['id'] . "' ORDER BY `id`"; $subcategories = $wpdb->get_results($subcategory_sql, ARRAY_A); if ($subcategories != null) { $output .= display_subcategories($option['id']); } else { // Adrian - check if the user wants categories only or sliding categories if (get_option('permalink_structure') != '') { $uri = $_SERVER['REQUEST_URI']; $category = explode('/', $uri); $count = count($category); $category_nice_name = $category[$count - 2]; $category_nice_name2 = $wpdb->get_var("SELECT `nice-name` FROM " . WPSC_TABLE_PRODUCT_CATEGORIES . " WHERE id='{$option['id']}'"); if ($category_nice_name == $category_nice_name2) { $list_product = true; } else { $list_product = false; } } if (get_option('catsprods_display_type') == 1 && ($option['id'] == $_GET['category'] || $list_product)) { // Adrian - display all products for that category $product_sql = "SELECT product_id FROM `" . WPSC_TABLE_ITEM_CATEGORY_ASSOC . "` WHERE `category_id` = '" . $option['id'] . "'"; $productIDs = $wpdb->get_results($product_sql, ARRAY_A); if ($productIDs != null) { $output .= "<ul class='category-product-list'>"; foreach ($productIDs as $productID) { $ID = $productID['product_id']; $productName_sql = "SELECT * FROM `" . WPSC_TABLE_PRODUCT_LIST . "` WHERE `id` = '" . $ID . "'"; $productName = $wpdb->get_results($productName_sql, ARRAY_A); if ($productName[0]['active']) { $output .= "<li class='cat-item'><a class='productlink' href='" . wpsc_product_url($ID, $option['id']) . "'>" . $productName[0]['name'] . "</a></li>"; } } //end foreach $output .= "</ul>"; } //end if productsIDs } //end if get_option } //end else $output .= "</li>"; } $output .= "</ul>"; } $output .= "</div>"; } if (get_option('show_categorybrands') == 1 || get_option('show_categorybrands') == 3) { if (get_option('show_categorybrands') == 1) { $output .= "<ul class='PeBrands branddisplay' style='display: none;'>"; } else { $output .= "<ul class='PeBrands branddisplay'>"; } //$output =''; $brands = $wpdb->get_results("SELECT * FROM `" . $wpdb->prefix . "product_brands` WHERE `active`='1' ORDER BY `order` ASC", ARRAY_A); if ($brands != null) { foreach ($brands as $option) { $output .= "<li><a class='categorylink' href='" . get_option('product_list_url') . $seperator . "brand=" . $option['id'] . "'>" . stripslashes($option['name']) . "</a></li>"; } } //$output .= $output; $output .= "</ul>"; } $output .= "</div>"; echo $output; }
function promotion_meta() { global $post; global $wpsc_query, $wpdb; $custom = get_post_custom($post->ID); $link = $custom["link"][0]; $saving = $custom["saving"][0]; $start_date = $custom["start_date"][0]; $end_date = $custom["end_date"][0]; $link_type = $custom["link_type"][0]; $promotion_link = $custom["promotion_link"][0]; $promotion_link_category = $custom["promotion_link_category"][0]; $category_data = $wpdb->get_results("SELECT `id`, `name`, `nice-name`, `description`, `image` FROM `" . WPSC_TABLE_PRODUCT_CATEGORIES, ARRAY_A); $prettyPhoto = $custom["pretty_photo"][0]; $link_type_options = array('Product' => array('value' => 'product', 'label' => __('Link To Product', 'flexishop')), 'Category' => array('value' => 'category', 'label' => __('Link To Category', 'flexishop')), 'External' => array('value' => 'external', 'label' => __('External Link', 'flexishop'))); $lightbox_options = array('Enable' => array('value' => 'yes', 'label' => __('Enable Lightbox', 'flexishop')), 'Disable' => array('value' => 'no', 'label' => __('Disable Lightbox', 'flexishop'))); ?> <div class="input radio"> <?php if (!isset($checked)) { $checked = ''; } foreach ($link_type_options as $option) { if ('' != $link_type) { if ($link_type == $option['value']) { $checked = "checked=\"checked\""; } else { $checked = ''; } } ?> <label class="description"><input type="radio" name="link_type" value="<?php esc_attr_e($option['value']); ?> " <?php echo $checked; ?> class="con-check" /> <?php echo $option['label']; ?> </label> <?php } ?> </div> <div id="external" class="input text hidden-field"> <label>Links To External:</label> <input cols="50" name="link" value="<?php echo $link; ?> " /> <div class="input radio"> <?php if (!isset($checked)) { $checked = ''; } foreach ($lightbox_options as $option) { if ('' != $prettyPhoto) { if ($prettyPhoto == $option['value']) { $checked = "checked=\"checked\""; } else { $checked = ''; } } ?> <label class="description"><input type="radio" name="pretty_photo" value="<?php esc_attr_e($option['value']); ?> " <?php echo $checked; ?> /> <?php echo $option['label']; ?> </label> <?php } ?> </div> </div> <div id="product" class="input select hidden-field"> <label><?php _e('Links To Product:', 'flexishop'); ?> </label> <select name="promotion_link"> <?php $wpsc_query = new WPSC_Query(); while (wpsc_have_products()) { wpsc_the_product(); ?> <?php $currentlink = str_replace("&", "&", wpsc_the_product_permalink()); ?> <option value="<?php echo wpsc_the_product_permalink(); ?> " <?php if ($promotion_link == $currentlink) { echo "selected = 'selected'"; } ?> ><?php echo wpsc_the_product_title(); ?> </option> <?php } ?> </select> </div> <div id="category" class="input select hidden-field"> <label><?php _e('Links To Category:', 'flexishop'); ?> </label> <select name="promotion_link_category"> <?php foreach ($category_data as $category_row) { $name = $category_row['name']; $url = str_replace("&", "&", wpsc_category_url($category_row['id'])); ?> <option value="<?php echo $url; ?> " <?php if ($promotion_link_category == $url) { echo "selected = 'selected'"; } ?> ><?php echo $name; ?> </option> <?php } ?> </select> </div> <div class="input text"> <label><?php _e('Savings:', 'flexishop'); ?> </label> <input cols="50" name="saving" value="<?php echo $saving; ?> " /> </div> <div class="input text"> <label><?php _e('Start Date:', 'flexishop'); ?> </label> <input name="start_date" value="<?php echo $start_date; ?> " class="date-input" /> </div> <div class="input text"> <label><?php _e('End Date:', 'flexishop'); ?> </label> <input name="end_date" value="<?php echo $end_date; ?> " class="date-input" /> </div> <?php }
function show_cats_brands($category_group = null, $display_method = null, $order_by = 'name', $image = null) { global $wpdb; if ($category_group == null) { $category_group = $wpdb->get_var("SELECT `id` FROM `" . $wpdb->prefix . "wpsc_categorisation_groups` WHERE `active` IN ('1') AND `default` IN ('1') LIMIT 1 "); } else { $category_group = (int) $category_group; } // Show cats & brands list if displaying on every page or if on a shop page (bit hacky but out of time). if (get_option('cat_brand_loc') != 3 && !function_exists("nzshpcrt_display_categories_groups") && $display_method != 'sidebar') { return; } if (get_option('permalink_structure') != '') { $seperator = "?"; } else { $seperator = "&"; } $output = "<div class='PeSwitcher'>"; switch (get_option('show_categorybrands')) { case 1: $output .= "<ul id='PeCatsBrandsBoth' class='category_brand_header'><li id='PeSwitcherFirst'><a href='' onclick='return prodgroupswitch(\"categories\");'>" . TXT_WPSC_CATEGORIES . "</a> | <a href='' onclick='return prodgroupswitch(\"brands\");'>" . TXT_WPSC_BRANDS . "</a></li></ul>"; break; } $output .= "</div>"; $output .= "<div class='PeCatsBrands'>"; if (get_option('show_categorybrands') == 1 || get_option('show_categorybrands') == 2) { $output .= "<div class='PeCategories categorydisplay'>"; $categories = $wpdb->get_results("SELECT * FROM `" . $wpdb->prefix . "product_categories` WHERE `group_id` IN ('{$category_group}') AND `active`='1' AND `category_parent` = '0' ORDER BY `" . $wpdb->escape($order_by) . "` ASC", ARRAY_A); if ($categories != null) { $output .= "<ul class='PeCategories'>"; foreach ($categories as $option) { // Adrian - check option for category count if (get_option('show_category_count') == 1) { //show product count for each category $count_sql = "SELECT count(*) FROM `" . $wpdb->prefix . "item_category_associations` WHERE `category_id` = '" . $option['id'] . "'"; $count = $wpdb->get_var($count_sql); $addCount = " [" . $count . "]"; } //end get_option // Adrian - if sliding category type selected, NO link for category text, mootools.js creates the linkable sliders onDomReady. if (get_option('catsprods_display_type') == 1) { $output .= "<li class='MainCategory'><strong class='category'>" . stripslashes($option['name']) . $addCount . "</strong>"; } else { // Adrian - otherwise create normal category text with or without product count if (!$image) { $output .= "<li class='MainCategory'><strong class='category'><a class='productlink' href='" . wpsc_category_url($option['id']) . "'>" . stripslashes($option['name']) . $addCount . "</a></strong>"; } else { $output .= "<li class='MainCategory'><img src='" . get_option('siteurl') . "/wp-content/uploads/wpsc/category_images/" . $option['image'] . "'><br><strong class='category'><a class='productlink' href='" . wpsc_category_url($option['id']) . "'>" . stripslashes($option['name']) . $addCount . "</a></strong>"; } } //end get_option $subcategory_sql = "SELECT * FROM `" . $wpdb->prefix . "product_categories` WHERE `group_id` IN ('{$category_group}') AND `active`='1' AND `category_parent` = '" . $option['id'] . "' ORDER BY `id`"; $subcategories = $wpdb->get_results($subcategory_sql, ARRAY_A); if ($subcategories != null) { $output .= display_subcategories($option['id']); } else { // Adrian - check if the user wants categories only or sliding categories if (get_option('catsprods_display_type') == 1) { // Adrian - display all products for that category $product_sql = "SELECT product_id FROM `" . $wpdb->prefix . "item_category_associations` WHERE `category_id` = '" . $option['id'] . "'"; $productIDs = $wpdb->get_results($product_sql, ARRAY_A); if ($productIDs != null) { $output .= "<ul>"; foreach ($productIDs as $productID) { $ID = $productID['product_id']; $productName_sql = "SELECT name FROM `" . $wpdb->prefix . "product_list` WHERE `id` = '" . $ID . "'"; $productName = $wpdb->get_var($productName_sql); $output .= "<li><a class='productlink' href='" . wpsc_product_url($ID, $option['id']) . "'>" . $productName . "</a></li>"; } //end foreach $output .= "</ul>"; } //end if productsIDs } //end if get_option } //end else $output .= "</li>"; } $output .= "</ul>"; } $output .= "</div>"; } if (get_option('show_categorybrands') == 1 || get_option('show_categorybrands') == 3) { if (get_option('show_categorybrands') == 1) { $output .= "<ul class='PeBrands branddisplay' style='display: none;'>"; } else { $output .= "<ul class='PeBrands branddisplay'>"; } //$output =''; $brands = $wpdb->get_results("SELECT * FROM `" . $wpdb->prefix . "product_brands` WHERE `active`='1' ORDER BY `order` ASC", ARRAY_A); if ($brands != null) { foreach ($brands as $option) { $output .= "<li><a class='categorylink' href='" . get_option('product_list_url') . $seperator . "brand=" . $option['id'] . "'>" . stripslashes($option['name']) . "</a></li>"; } } //$output .= $output; $output .= "</ul>"; } $output .= "</div>"; echo $output; }
function wpsc_product_url($product_id, $category_id = null) { global $wpdb, $wp_rewrite, $wp_query; if (!is_numeric($category_id) || $category_id < 1) { if (is_numeric($wp_query->query_vars['product_category'])) { $category_id = $wp_query->query_vars['product_category']; } else { $category_list = $wpdb->get_row("SELECT `" . $wpdb->prefix . "product_categories`.`id`, IF((`" . $wpdb->prefix . "product_categories`.`id` = '" . get_option('wpsc_default_category') . "'), 0, 1) AS `order_state` FROM `" . $wpdb->prefix . "item_category_associations` , `" . $wpdb->prefix . "product_categories` WHERE `" . $wpdb->prefix . "item_category_associations`.`product_id` IN ('" . $product_id . "') AND `" . $wpdb->prefix . "item_category_associations`.`category_id` = `" . $wpdb->prefix . "product_categories`.`id` AND `" . $wpdb->prefix . "product_categories`.`active` IN('1') LIMIT 1", ARRAY_A); $category_id = $category_list['id']; } } if ($wp_rewrite->rules != null && $wp_rewrite != null || get_option('rewrite_rules') != null) { $url_name = get_product_meta($product_id, 'url_name', true); $product_url = wpsc_category_url($category_id) . $url_name[0] . "/"; } else { if (!stristr(get_option('product_list_url'), "?")) { $initial_seperator = "?"; } else { $initial_seperator = "&"; } if (is_numeric($category_id) && $category_id > 0) { $product_url = get_option('product_list_url') . $initial_seperator . "category=" . $category_id . "&product_id=" . $product_id; } else { $product_url = get_option('product_list_url') . $initial_seperator . "product_id=" . $product_id; } } return $product_url; }
function a_page_url($page = null) { //exit('<pre>'.print_r($this, true).'</pre>'); $curpage = $this->query_vars['page']; if ($page != '') { $this->query_vars['page'] = $page; } //global $wpsc_query; if ($this->is_single === true) { $this->query_vars['page'] = $curpage; return wpsc_product_url($this->product['id']); } else { $output = wpsc_category_url($this->category); //exit('PAge <pre>'.print_r($this,true).'</pre>'); if ($this->query_vars['page'] > 1) { // if (get_option('permalink_structure')) { $output .= "page/{$this->query_vars['page']}/"; } else { $output = add_query_arg('page_number', '', $output); } } // $this->query_vars['page'] = $urpage; // exit('Whats returned: '.$output); return $output; } }
$category_data = $wpdb->get_results("SELECT `id`, `name`, `nice-name`, `description`, `image` FROM `" . WPSC_TABLE_PRODUCT_CATEGORIES . "` WHERE `active` = '1' AND `group_id` = '" . (int) $group_id . "'", ARRAY_A); ?> <div class="slider-mask<?php if (count($category_data) > 5) { echo ' slideable'; } ?> "> <div class="front-category-slider"> <?php $i = 0; foreach ($category_data as $category_row) { $name = $category_row['name']; $id = $category_row['id']; $description = $category_row['description']; $url = wpsc_category_url($category_row['id']); $image = wpsc_category_image($id); ?> <?php if ($i % 5 == 0) { echo '<div class="full-width"><ul class="front-category-list">'; } ?> <li <?php if ($i % 5 == 4) { echo 'class="col-right"'; } ?> > <div class="padding"> <a href="<?php