Category Archives: OKU

Fix broken product links – found for Mestergull

On 20140711 Mestergull broken product links were reported.

They are saved okay in wp_postmeta table on “_product_attributes” field, but for some reason, when using

[php]

woocommerce_get_product_terms( $product->id, ‘pa_product-link’, ‘names’ );

[/php]

the link was truncated to 168 characters.

So, I coded this:

[php]

$xxx = get_post_meta( $product->id, ‘_product_attributes’);
foreach ($xxx[0] as $pa){
if ($pa[‘name’] == ‘pa_product-link’){
$product_link = $pa[‘value’];
break;
}
}

[/php]

Which fetches the entire product link value.

Move grid list buttons higher

In order to move the two grid/list buttons on top right corner of product listing page I had to edit plugins/woocommerce-grid-list-toggle/grid-list-toggle.php file:

[php]

add_action( ‘woocommerce_before_shop_loop’, array(&$this, ‘gridlist_toggle_button’), 1);

[/php]

Instead of “1” was “30”…

Show selected category on “Active Filters”

Changes on twentyoku/widgets/oku-widget-layered_nav.php file:

[php]

global $wp_query;
$cat_obj = $wp_query->get_queried_object();

echo "<li class=’chosen_cat’>" . $cat_obj->name . "</li>";
echo "<li class=’cat_br’> > </li>";

&nbsp;

/**
* Begin Show selected category on "Active Filters"
*/
echo $before_widget;
if ( $title ) {
echo $before_title . $title . $after_title;
}
echo "<ul>";
echo "<li class=’chosen_cat’>" . $cat_obj->name . "</li>";
echo "</ul>";

echo $after_widget;
//end Show selected category on "Active Filters"

[/php]

Look after Begin Show selected category on “Active Filters” – it’s in 3 places in that file.

Also, on style.css:

[css]

li.current-cat a, li.chosen_cat{
background: scroll 6px center #21759B !important;
border: 1px solid #21759B !important;
border-radius: 3px;
color: #FFFFFF !important;
padding: 0 6px 0 6px;
}

li.chosen_cat{
cursor: pointer;
margin-right: 5px;
padding: 0 6px !important;
}

li.cat_br{
margin-right: 5px;
}

[/css]