Sunday, December 9, 2012


I wanted to show a list of Suppliers on the left and if one was clicked show a page in the center with address etc to that Supplier.
This showed to be quite a challenge.

The first obstacle was that the link on the title SUPPLIERS didn't work (this was not important, but annoying).
It turned out that I had to check Display suppliers and manufacturers in Preferences/General, which may seem natural except for the description of what that meant, which reads Display suppliers and manufacturers lists even if corresponding blocks are disabled.
My Manufacturers Block is disabled, but of course no Manufacturers showed when I ticked Yes...

No, the first obstacle was that the logos didn't show up with IE. This was because $mediumSize.width and $mediumSize.height wasn't defined, I removed that code and hardcoded a width of 200.

Then for the contact information for the Suppliers.
The module is meant to just list all products supplied by the Suppliers, I don't know why there is address etc to be filled out in the BO because AFAIK that information is never used anywhere.

I had to make the information available to themes/supplier.tpl
I inserted code in classes/supplier.php to fetch it from the database, it turned out to be the wrong place and/or file so I won't give all details but basically
$query->select ' ... a.`id_supplier.address1`');
$query->leftjoin('address', 'a', 's.`id_supplier` = a.`id_supplier`');

This turned out to make the address available to themes/supplier-list.tpl but not to themes/supplier.tpl so I did a ugly hack in suppliercontroller.php
I had the data in $suppliers but not in $this->supplier, so I looped through $suppliers and pulled the wanted fields into standalone variables, i.e.
$addr1 = $row['address1'];
and make those available with i.e.
'addr1' => $addr1

Finally I could use e.g. {$addr1} in themes/supplier.tpl

Saturday, December 8, 2012

Header stuff

I've been goofing around a bit with 1.5.2, setting up a new store where I will sell handicraft that I make.

I wasn't all too happy with the header so I made some changes, this is the header taken from the PS demo page
And this is my header

I'm not too good at logo designing so I just took a picture of wood grain and cut out a slice for a banner, and added the text with, I may have made some changes to the image, I don't remember.

The cart and possibly the search box either didn't show up clearly or was too distinct (again, I don't remember) so I added opacity, and made the text black in the CSS


-khtml-opacity: 0.6;
opacity: 0.6;

I also used opacity on the active language's flag (as opposed to the behaviour in 1.4 where the inactive language's flag(s) have opacity.)

To make the flags appear side by side, I changed modules/blocklanguages/blocklanguages.tpl
Basically, I removed the ul and li tags, this is my code after the change

<div id="languages_block_top_mod">

<div id="countries">
{foreach from=$languages key=k item=language name="languages"}
{if $language.iso_code != $lang_iso}
{assign var=indice_lang value=$language.id_lang}
{if isset($lang_rewrite_urls.$indice_lang)}
<a href="{$lang_rewrite_urls.$indice_lang|escape:htmlall}" title="{$}">
<a href="{$link->getLanguageLink($language.id_lang)|escape:htmlall}" title="{$}">
<img {if $language.iso_code == $lang_iso}class="opacity"{/if} src="{$img_lang_dir}{$language.id_lang}.jpg" alt="{$language.iso_code}" width="16" height="11" />
{if $language.iso_code != $lang_iso}

Then, for currencies, I changed modules/blockcurrencies/blockcurrencies.tpl
I removed

<form id="setCurrency" action="{$request_uri}" method="post">

<input type="hidden" name="id_currency" id="id_currency" value=""/>
<input type="hidden" name="SubmitCurrency" value="" />
{l s='Currency' mod='blockcurrencies'} : {$blockcurrencies_sign}
<ul id="first-currencies" class="currencies_ul">

and the closing form tag and the li tags.
This is how the code looks now

<div id="currencies_block_top"><b>

{foreach from=$currencies key=k item=f_currency}
{if $cookie->id_currency == $f_currency.id_currency}
<div id="selected">
<div id="unselected">
<a href="javascript:setCurrency({$f_currency.id_currency});" title="{$}">{$f_currency.sign}</a>

In the CSS, I changed #selected to

#selected {

-khtml-opacity: 0.6;
opacity: 0.6;

Then I moved around the blocks a bit with CSS, but no magic in that. :-)
Not too much explaining, just some pasted code... Sorry about that, I'll try to remember more exactly what I change in the future...

Monday, December 3, 2012

PS 1.5 - warning, please wait for mature version!

Long time no blogging, I'll see if I can rectify that...

I've been playing around with PS 1.5.2 for a bit and I must say that 1.5 is not yet mature.
Some bugs I've found:
  • Installing 1.5.2 breaks other installations if same database is used! - I installed 1.5.2 and supplied db-prefix hk_, after install, all references to Swedish was wiped out from my old installation that has ps_ as db-prefix.
  • With a Swedish browser (tested with FF 16 and IE 9) and registring a new address as customer, El Salvador is proposed as country (see old blog post for plausible reason).
  • For apparently no reason, sometimes all products show up twise; if this happens, don't delete the duplicates since that removes the originals too.
  • When searching for products, either via the search box or by clicking a tag, some products are listed with a price of 0; in other views (featured, category etc) the price is shown OK). In the cart, prices are OK so no monetary risk but not very pretty.
  • The Suppliers Block is broken: The title bar is not a link, if code is changed to make it work clicking it shows "There are no suppliers." ($nbSuppliers that is supposed to hold the number of suppliers is 0 and no variables holds any supplier-info.)
  • The MoneyBookers Module has a small issue that the image that is supposed to show up has the wrong name in the code (or the image is not included/has the wrong name).
  • It is getting increasingly difficult to get help via the forum.
  • I'm not sure if reporting bugs does any good since there is absolutely zero feedback.
  • Not that many Modules/Themes are ported/developed for 1.5 because, I would think, of the issues with that version.
I'll try to get back soon with some information on a couple of tweaks I've done.