Click here for larger image
Figure 1. OXID eShop Installation Wizard: Checking System Requirements
Click here for larger image
Figure 2. OXID eShop Installation Wizard: Selecting Default Language
Click here for larger image
Figure 3. OXID eShop Installation Wizard: Setting Up the Database
Click here for larger image
Figure 4. OXID eShop Installation Wizard: Setting Installation Paths
/oxid/). Then, create a MySQL database and prepare the user credentials (see Figure 3). Open the directory you created through a web browser (e.g., http://localhost/oxid/). The installation wizard should pop up.
get() or set() methods.
/oxid/views directory and corresponding model classes in the /oxid/core directory. You can overload both class groups as modules, which allows nearly unlimited possibilities for extension and modification. You can review the API documentation to obtain a better understanding of the class structures.
/oxid/out/basic/tpl (front-end) and /oxid/out/admin/tpl (back-end). They are pure HTML files, where you can embed content with so-called "Smarty-Tags." Therefore, you can perform limitless visual customizations, provided you inherit the respective Smarty-Tags accurately.
/oxid/modules directory. You must register this module in the administration area, so that the system knows to factor in the new module (if necessary) when instantiating a new object.
oxcontents table. You can do this either via phpMyAdmin or with the following SQL command:
ALTER TABLE 'oxcontents' ADD 'MY_PARENTIDENT' VARCHAR( 32 ) NOT NULL;
OXLOADID of the parent element, provided the element is a child element. In order to do so, the newly created field must be editable by the eShop administrator. This requires an adjustment to the template content_main.tpl, as follows (bold lines indicate additions):
<tr>
<td class="edittext">
[{ oxmultilang ident="GENERAL_IDENT" }].
</td>
<td class="edittext">
<input type="text" class="editinput" size="28"
maxlength="[{$edit->oxcontents__oxloadid->fldmax_length}]"
name="editval[oxcontents__oxloadid]"
value="[{$edit->oxcontents__oxloadid->value}]" [{ $readonly }]>
[{ oxinputhelp ident="HELP_GENERAL_IDENT" }]
</td>
</tr>
<tr>
<td class="edittext">parent ident</td>
<td class="edittext">
<input type="text" class="editinput" size="28"
maxlength="[{$edit->oxcontents__my_parentident->fldmax_length}]"
name="editval[oxcontents__my_parentident]"
value="[{$edit->oxcontents__my_parentident->value}]" [{ $readonly }]>
</td>
</tr>
Click here for larger image
Figure 5. OXID eShop Administration: The Updated CMS Form with Parent-Child Linking Field
object name]->[table name]__[field name]->value
/oxid/tmp directory, as object structures are cached there.
test_1 as the unique identifier (OXLOADID) for the first CMS component. The second CMS component then inherits the identifier of the first component (test_1) as its MY_PARENTIDENT value.
oxContentList class via the oxcontentlist::_loadMenue() method. You must override this method within the scope of the module. In order to do so, create a new file at /oxid/modules/my_cms/my_cms_oxcontentlist.php and add the following code to it.
<?php
class my_cms_oxContentList extends my_cms_oxContentList_parent
{
protected function _loadMenue( $iType, $sSQLAdd = null )
{
if($iType == 1) {
$sSQLAdd .=" and my_parentident = ''";
}
parent::_loadMenue($iType, $sSQLAdd);
}
}
?>
my_cms_oxContentList doesn't directly extend oxContentList; instead, it extends my_cms_oxContentList_parent. This is the recommended method of extending OXID classes, as it allows numerous modules to be created and inter-linked from the same base class. Internally, OXID will automatically generate transparent classes using the following structure:
my_cms_oxContentList extends my_cms_oxContentList_parent { }
my_cms_oxContentList_parent extends oxContentList { }
$iType can have the values 0, 1, 2 or 3, depending on whether the CMS component is a snippet, main menu item, category, or manual define, respectively. The if() conditional test is used to get only data sets that don't have a parent (for CMS components defined as main menu items). Therefore, the CMS sub-menu component Test 1.1 will not appear in the main menu.
oxcontentlist => my_cms/my_cms_oxcontentlist
/oxid/modules directory and without the .php extension (see Figure 6). If there were more modules using the class oxContentList, they would be appended to the right list and separated with an ampersand (&), as below:
oxcontentlist => my_cms/my_cms_oxcontentlist&my_test/test
Click here for larger image
Figure 6. OXID eShop Administration: Adding a Custom Module
content.php, using the following code:
<?php
class my_cms_Content extends my_cms_Content_parent
{
public function render()
{
$this->_sThisTemplate = parent::render();
$sSelect = "select oxid from oxcontents
where my_parentident = '".$this->getContent()->oxcontents__oxloadid->value."'";
$rs = oxDb::getDb()->Execute($sSelect);
if($rs != false && $rs->RecordCount() > 0) {
$aChilds = array();
while(!$rs->EOF) {
$oContent = oxNew("oxcontent");
$oContent->load($rs->fields[0]);
$aChilds[ ] = $oContent;
$rs->MoveNext();
}
$this->_aViewData['aChilds'] = $aChilds;
}
return $this->_sThisTemplate;
}
}
/oxid/modules/my_cms/my_cms_content.php.
oxDb::getDb(). The query retrieves all CMS components whose MY_PARENTID corresponds to the OXLOADID of the current component. This produces a resultset containing all the sub-menu items of the current main menu item. A while() loop is then used to initialize new oxContent objects, load them with data, and then write them into the array $aChilds. The array is then made available to the view as a template variable.
oxContent objects in the output template. Open the template file content.tpl and insert the following code under the line <div class="box">:
[{if $aChilds}]
<div style="border:1px solid #ccc">
Submenu:<br />
[{foreach from=$aChilds item=oContent}]
<a href="[{ $oViewConf->getSelfLink() }]cl=content&tpl=[{$oContent->oxcontents__oxid->value}]">
- [{$oContent->oxcontents__oxtitle->value}]</a><br />
[{/foreach}]
</div>
<br />
[{/if}]
content => my_cms/my_cms_content
Click here for larger image
Figure 7. OXID eShop Administration: Adding a Custom Module
Click here for larger image
Figure 8. OXID eShop: The Main Menu with Child Menus Displayed
| Andreas Ziethen, executive director of the anzido GmbH Dortmund, has been involved, as OXID Premium Solution Partner, in the implementation of shop projects based on the OXID eShop-Software since 2003. He acts as trainer within the OXID Academy and offers seminars, workshops and consulting for PHP, in particular, the OXID eShop. to e-mail him. |