Miha Trtnik

Welcome to Webeks

Simple order form component for Joomla! 1.5

E-mail Print
Simple order form is a very basic e-shop component for Joomla! 1.5.
A client of mine needed to sell only few products and I didn't require a big and fancy web store. So this component was developed.

License

You can use this component for personal or commercial use, but you may not redistribute it under your own name. Sites that have this component (or derivates from it) installed are required to link to my site (http://www.webeks.net).

If you use this component please let me know. I can post a link to your site if you'd like.

Oh yeah ... and you use this component on your own risk!


Download

Simple order form


Screenshots




Version log

14. May 2009 - 1.1b
  • 500 error fixed - some OS (like linux) are case sensitive I had to rename few files, now it should work OK
5. May 2009 - 1.0b
  • error fixed - when submitting invalid data on frontend
  • component configuration enabled
  • send owner a mail when new order arrives
  • send confirmation mail to the client after order
  • few untranslated strings fixed
3. May 2009 - first release

FAQ

If you see some strange code after installing component, please see if short_open_tag directive is  set to On in your php.ini file!



 

Date and time with PHP and MySQL

E-mail Print

Did you wander what is the best way to manage dates stored in a MySQL database and used with PHP application?

PHP way

PHP uses unix timestamps for all its date functionality. Functions to format and convert this timestamps are available. Timestamp is simply an unsigned integer - it’s the number of seconds that have elapsed since midnight on January 1st 1970 (greenwich mean time).

MySQL way

MySQL has three date types for use in columns. These are DATETIME, DATE, and TIMESTAMP.

  • DATETIME - stores date and time as a string in the form YYYY-MM-DD HH:MM:SS (e.g. 2009-04-25 13:43:15).
  • DATE - use just the date part of this format - YYYY-MM-DD (e.g. 2006-12-25).
  • TIMESTAMP - a DATETIME column that automatically updates to the current time every time the contents of that record are altered. Don't confuse this type with UNIX timestamp! 

As we can see this two formats are not compatible with each other. In our application we need to convert between them. And here is the question - which format is better to be stored in the database?!
Read more...
 

JTable get last inserted id

E-mail Print
At first glance it seems that Joomla JTable lacks a lastInsertedId() function. Here is how we can get last inserted id
$row->bind($data);
$row->check();
$row->store();
 
$lastId = $row->id;
 
 

Joomla - how to set up a component and link MVC together

E-mail Print
I expect you understand MVC principle.
Joomla 1.5 developers eagerly praise MVC and there are uncounted articles written on Joomla MVC. And each one of them uses different approach. Joomla MVC framework should standardise arhitecture but unfortunately even core Joomla doesn't follow the same directory order. I don't know why this is but it is confusing and frustrating. It would be nice if all components followed simple rules and structure.
Read more...
 

Cascading ExtJs combobox

E-mail Print
I had to create cascading combo-boxes for country / city selection. I looked at sample tutorial on extjs page. However there is example for local store and I have my values stored in the database.

At first I set store and combo box separately and add a select listener on country box - so that when countries field changes it updates city field. It worked when user made their first selection. Then it just didn't refresh combo box values although ajax request was made and proper json response was provided.



Code looked something like that:
it DOESN'T WORK
//function that gets city store
function getCityStore(countryIdVar)
{
var store = new Ext.data.JsonStore({
url: 'get-city-by-country-id',
baseParams: countryId:countryIdVar,
fields: [
{name:'cityId', type:'int'},
'cityName'
]
});
return store;
}

//than I have a countries combo
var countries = new Ext.form.ComboBox({
id:'country',
store: getCountryStore,
typeAhead: true,
triggerAction: 'all',
emptyText: '...',
listeners: {
select: {
fn:function(combo, value) {
var modelDest = Ext.getCmp('city');
//set and disable cities
modelDest.setDisabled(true);
modelDest.setValue('');
modelDest.store.removeAll();
modelDest.store = getCityStore( combo.getValue() );
modelReg.setDisabled(false);
}
}
}
})

After a day worth researching I found out that this is incorrect way of doing things. And I still don't know why - is it a bug or is just my knowledge of JavaScript and ExtJs so bad that I cannot understand it.

Below is the way it works.
//function that gets city store
function getCityStore()
{
var store = new Ext.data.JsonStore({
url: 'get-city-by-country-id',
//baseParams: countryId:countryIdVar,
fields: [
{name:'cityId', type:'int'},
'cityName'
]
});
return store;
}

//than I have a countries combo
var countries = new Ext.form.ComboBox({
id:'country',
store: getCountryStore(),
typeAhead: true,
triggerAction: 'all',
emptyText: '...',
listeners: {
select: {
fn:function(combo, value) {
var modelDest = Ext.getCmp('city');
//set and disable cities
modelDest.setDisabled(true);
modelDest.setValue('');
modelDest.store.removeAll();
//reload region store and enable region
modelDest.store.reload({
params: { countryId: combo.getValue() }
});

modelReg.setDisabled(false);
}
}
}
})
Hope it will help someone ... :)
 

ExtJS programming - MVC application layout, OOP and more

E-mail Print
We are using ExtJS and Zend in Bookingpoint project.

First we used ExtJS as a supplement for good old HTML - and thinking behind the program was old as well. JavaScript code is expanding and we'll have to reconsider our programming style.

Very good tutorials that we should've started with are:
Read more...
 

Simple ExtJS drop down list

E-mail Print
I've just spent almost two hours trying to get simple drop down list into my script. I would swear I've done it like it's done in an example on ExtJS page.

I was almost at the end of my nerves and I even considered to abandon ExtJs and go back to simple html where everything was much easier :)


Then ... like so many times before it "just started" to work !!!  :) Code that works is provided below.

var my_values = [
    ['one'],
    ['two'],
    ['three'],
    ['four'],
    ['five']
];
 
 
var numberField = new Ext.form.ComboBox({
    fieldLabel: 'Number',
    hiddenName: 'number',
    store: new Ext.data.SimpleStore({
        fields: ['number'],
        data : my_values 
    }),
    displayField: 'number',
    typeAhead: true,
    mode: 'local',
    triggerAction: 'all',
    emptyText:'Choose number...',
    selectOnFocus:true
});
 

JavaScript best practise

E-mail Print
Some recommendations on how to code JavaScript.
Read more...
 

Event list for Joomla 1.5 with selectable cities and countries

E-mail Print
I'm working on a renewal of Fajn.si and for this I'm using Joomla 1.5 and events extension written by Schlu.

I want to enable venue owners ability to insert their places by them selves.

Original EventList component has cities inserted in venues table as a string. And that is bad. Bad because of two things. Sooner or later users will insert inconsistent city names for their venues. And second argument is that city sorting can become slow when we have large number of venues. Large number for mysql indexed field should start with thousands if not ten or hundred thousands records so don't panic :) But still this is not proper database design and normalization.
Read more...
 
  • «
  •  Start 
  •  Prev 
  •  1 
  •  2 
  •  Next 
  •  End 
  • »
Page 1 of 2

Sponsored Links