Add new field in the admin side

julia

No avatar

2005-07-31 08:19

hi all
I use QC v025
and want to add new field -"costPrice", to the admin side of the shop
i did the folowing code
what is missing/wrong?
treewood (please!!!) can you lead me ?

templates/admin/products_form.tpl

line 5
Array(
Array( "sName" )
,Array( "iCategory", "int" )
,Array( "fPrice", "float" )
,Array( "fcostPrice", "float", null, "false" )
,Array( "sShortDescription", "txt", 3 )
,Array( "iPosition", "int", "-1", null, ">", "false" )
,Array( "iPosition", "int", "999", null, "<", "false" )
,Array( "costPrice", "int" )
) );'>





line 53 - the field in the admin-form

<tr>
<td style='text-align: right; padding: 5px;'>
$lang[costPrice]:&nbsp;
</td>
<td>
<input type='text' name='fcostPrice' value="$aProduct[costprice]" size='8' maxlength='8' style='text-align: right;' class='input' />
$config[currency_symbol]
</td>
</tr>





core/products-ff

line 210 or173

function dbAddProduct( $aForm ){
global $oFF;
extract( $aForm );
$oFF->setRow( Array( sprintf( '%02.0f', $iPosition ), $sName, $iProduct, $iCategory, $fPrice, $costPrice, $sShortDescription, $sFullDescription, $iStatus ) );
$oFF->addToFile( DIR_DB.DB_PRODUCTS );
} // end function dbAddProduct
}

julia

No avatar

2005-08-07 13:39

O.K here is the wayI find to add new filed - cost price - to the admin side
thanks to the help of wizzud the great!!

templates/admin/products_form.tpl
line 5
Array(
Array( "sName" )
,Array( "iCategory", "int" )
,Array( "fPrice", "float" )
,Array( "fcostPrice", "float" )
,Array( "sShortDescription", "txt", 3 )
,Array( "iPosition", "int", "-1", null, ">", "false" )
,Array( "iPosition", "int", "999", null, "<", "false" )

line53
<tr>
<td style='text-align: right; padding: 5px;'>
$lang[costPrice]:&nbsp;
</td>
<td>
<input type='text' name='fcostPrice' value="$aProduct[costprice]" size='8' maxlength='8' style='text-align: right;' class='input' />
$config[currency_symbol]
</td>
</tr>

templates/admin/products_list.tpl
line 73
<!-- costprice -->
<tr>
<td style='text-align: left; padding: 5px;'>
$lang[costPrice]:&nbsp;
</td>
<td>
$aProducts[costprice]&nbsp;$config[currency_symbol]
</td>
</tr>


core/products-admin.php
add in line 23

$aForm['fcostPrice'] = ereg_replace( ',', '.', $aForm['fcostPrice'] );
$aForm['fcostPrice'] = tPrice( $aForm['fcostPrice'] );

add in line 100

$aForm['fcostPrice'] = ereg_replace( ',', '.', $aForm['fcostPrice'] );
$aForm['fcostPrice'] = tPrice( $aForm['fcostPrice'] );

core/products-ff
line211

function dbAddProduct( $aForm ){
global $oFF;
extract( $aForm );

$oFF->setRow( Array( sprintf( '%02.0f', $iPosition ), $sName, $iProduct, $iCategory, $fPrice, $sShortDescription, $sFullDescription, $iStatus , $fcostPrice) );
$oFF->addToFile( DIR_DB.DB_PRODUCTS );
} // end function dbAddProduct

core/products-ff
line256

function dbChangeProduct( $aForm ){
global $oFF;
extract( $aForm );

$oFF->setRow( Array( sprintf( '%02.0f', $iPosition ), $sName, $iProduct, $iCategory, $fPrice, $sShortDescription, $sFullDescription, $iStatus , $fcostPrice ) );

$oFF->changeInFile( DIR_DB.DB_PRODUCTS, $iProduct, 2 );
} // end function dbChangeProduct

core/products

line 59

list( $aProducts['position'], $aProducts['name'], $aProducts['id'], $aProducts['category'], $aProducts['price'], $aProducts['shortDescription'], $aProducts['fullDescription'], $aProducts['status'],$aProducts['costprice'] ) = $aData[$i];
line 172


list( $aProduct['position'], $aProduct['name'], $aProduct['id'], $aProduct['category'], $aProduct['price'] , $aProduct['shortDescription'], $aProduct['fullDescription'], $aProduct['status'] ,$aProduct['costprice'] ) = $aData ;

robbo

No avatar

2005-09-07 06:42

You ripper of a lady!

Got it working with a Stock feature! :)
Thanks a lot Julia!

robbo

No avatar

2005-09-17 10:42

Ok, would anyone know why this will only allow 1 additional field?
Is there code somewhere which prevents the amount of fields allowed that has to be changed?

Any help would be great!
Rob.

floyds

No avatar

2005-09-17 20:09

is there a site with this on it, so we can see what is does ?!

Dutch QuickCart Support Site

julia

No avatar

2005-09-17 20:20

you souldn't have problem adding more then one i added 3 fileds ,show me what you did

ORiON

No avatar

2005-11-10 18:42

Hey Julia.... how i insert a dropbox with 2 options???

Foobar

No avatar

2005-11-10 23:12

Hi Julia,

Followed your instructions to the letter and it did not work . . . :-(
No extra data in the database.

Can you check again and make sure you've posted the exact method for creating the new admin field or let me have a look at your site to see it working please???

Thanx so much

julia

No avatar

2005-11-12 21:12

Dear Foobar
if you would read the first 2 line of this topic you will know the reason why you didn't succeeded, will you make some effort please!
i worked on it for 2 mounth untill succee came and you can't read the instrctions?

ORiON

No avatar

2005-11-12 22:28

Hi Julia, can you explain how i insert a dropbox with 2 options in the cart?

julia

No avatar

2005-11-13 09:37

Hi Orion
I fund a guy that maybe do some changes to the cart but it cost 40$-60$ for little things such you ask, if you want, post here your email address

ORiON

No avatar

2005-11-14 23:03

Ok.. but i'm in the correct way... see...

i open 'orders_delivery.tpl' and i have added 2x and modified that i wanted

           <tr>
            <
td class='form_desc'>
              
$lang[Courier]:&nbsp;
            </
td>
            <
td class='form_desc_data'>
              <
select name='iCourier' class='input' onchange='ordersCouriers( this );'>
                <
option value=''>$lang[choose]</option>
                
$sSelectCourier
              
</select>
            </
td>
          </
tr>


i added this:


          
<tr>
            <
td class='form_desc'>
              
$lang[Question1]:&nbsp;
            </
td>
            <
td class='form_desc_data'>
              <
select name='Question1' class='input' onchange='ordersCouriers( this );'>
                <
option value=''>$lang[choose]</option>
                
$sSelectQuestion1
              
</select>
            </
td>
          </
tr>


and in 'en.php' language file i added a line

$lang[Question1'] = 'Here a Question;



but i don't know how to add 2 options.. :(
i have to do a file do call the string $sSelectQuestion1 but i don't know how!

help me!

Foobar

No avatar

2005-11-17 11:58

Dear Julia,

Thanx for your brow beating but have tried to add fields in QC v0.2.5, v0.3.0 and v1.0 all without success. I am not a php coder and was only asking you to check you had posted the solution. I have messed about with the code over and over again for several weeks myself before coming to the forum for help. If I wanted to be textually abused I would ask my girlfriend and not come to a support forum . . . lol

Seriously though I was just hoping someone would be able to shed a bit of light on the subject for me??!!

ermac

No avatar

2008-02-08 12:05

ok anyone knows how to make it in v2.2?
i,v added analogically lines in it but that seems not work - database is saved corectly but added fileds cannot be readed into templates

Back to top
about us | contact