PDA

Zobacz pełną wersję : Dj classifieds - rozbudowa formularzu.



krzy5iek
11-12-2010, 21:42
Może ktoś wie gdzie w dj classifieds w jakim pliku można trochę rozbudować formularz, a dokładniej chcę dodać kilka pól do wypełniania takich jak np telefon czy miasto itp. Wiem że te informacje można podać w tych polach co są ale chodzi o to ze jak nie będzie tych pól to sprzedający nie wpisze mi tych informacji a to bardzo ważne :).

agnieszkaaga
12-12-2010, 15:03
<a href="http://www.edugames.pl" target="_blank">Gry Edukacyjne Edugames</a>
Gry Edukacyjne Edugames (http://www.edugames.pl)

krzy5iek
14-12-2010, 22:30
No dobra, znalazłem jak dodać pole w formularzu, jak wyświetlić nazwę pola w ogłoszeniu, ale nie dam rady wyświetlić zawartości tego dodanego pola w ogłoszeniu :) może ktoś wie gdzie dopisać jedną linijkę kodu :P albo dwie.
to jest chyba w pliku com_djclassifieds/views/showitem/tmpl/defalut.php
a dokładnie w miejscu:

<div class="item">
<?php
echo '<div class="title_top">'.$i->name.'</div>';
echo '<div class="name">';
echo '<a class="title" href="index.php?option=com_djclassifieds&view=showitem&cid='.$i->cat_id.'&id='.$i->id.'">'.$i->name.'</a>';
echo '</div>';
echo '<div class="description"><h2>'.JText::_('Description').'</h2>'.$i->description.'</div>';
echo '<div class="description1"><h2>'.JText::_('Description1').'</h2>'.$i->description.'</div>';


description1 to moje nowe pole formularzu, w tej postaci description1 wyświetla zawartość description, gdy zmienie $i->description.'</div>'; na $i->description1.'</div>'; nie wyświetla mi zawartości mojego nowego pola. Nie mam nic pojęcia o PHP i wszystko robie metoda prób i błędów :) Wiec proszę o małą wskazówkę a resztę poradzę sam.

artur301pl
09-04-2011, 22:28
Niestety po angielsku ale podobno działa :)

Adding Fields to djClassifieds
Before I even start, please note that this tutorial is based on the advice of 'dontysk' in previous replies, who deserves all credit.

OK, Let's say we want to add a telephone number field called 'phone' to our ad.
We need to make changes in the database, backend and frontend.

Step 1 – Database
Look for a table called "jos_djcf_items" in your database, I use phpMyAdmin for that matter. In "structure", you will get the entire set of fields where

you can add 'phone'. Make sure you define it properly in terms of encoding, type etc.

Step 2 – Backend

Step 2.1 – tables folder
go to /public_html/administrator/components/com_djclassifieds/tables/items.php

Right below line 45 - var $intro_desc = null; add the following:

var $phone = null;

Step 2.2 – views folder
Go to /public_html/administrator/components/com_djclassifieds/views/edititem/tmpl/ default.php

Right below line 120, after "intro_desc" part, add the following:

<tr>
<td width="100" align="right" class="key">
<?php echo JText::_('PHONE');?>
</td>
<td>
<?php //echo $editor->display( 'phone', $this->nl->phone, '100%', '100', '40', '10',false );
?>
<textarea id="phone" name="phone" rows="2" cols="20" class="inputbox"><?php echo $this->nl->phone; ?></textarea>
</td>
</tr>

Step 3 – Frontend
Step3.1.1 – Views/AddItem folder
Go to /public_html/components/com_djclassifieds/views/additem/tmpl/default.php

After line 101 add the following:

<tr>
<td width="100" align="right" class="label"><?php echo JText::_('phone');?><div id="ile">(10)</div>
</td>
<td><textarea id="phone" name="phone" rows="1" cols="10" class="inputbox" onkeyup="checkt();" onkeydown="checkt();"><?php echo $this->nl->phone; ?

></textarea>
</td>
</tr>

Step3.1.2 – Views/AddItem
Still in the same file, in the alert section of default.php, After line230 add the following :

}else if(document.getElementById("phone").value==''){
alert("<?php echo JText::_('Please enter a phone number');?>");

Step3.2 – Views/ShowItem folder

Go to /public_html/components/com_djclassifieds/views/showitem/tmpl/default.php

After line 84 add the following:

<div class="row">
<span><?php echo JText::_('PHONE'); ?><?php echo $i->phone;?></span>
</div>

Step 4 – Add the JText tag in Language files

Backend - /public_html/administrator/language/en-GB/en-GB.com_djclassifieds.ini
Fronend - /public_html/language/en-GB/en-GB.com_djclassifieds.ini
* Don't forget to save in UTF-8
Add it to any relevant language ini file, preferably after the "short description" tags:

SHORT_DESCRIPTION=Description
PHONE=phone

Thats it !
Enjoy,
Yariv

Na pewno działa, dzisiaj sprawdziłem :p dodałem pole telefon i miasto.

Pozdrawiam :)