info

Postate qui discussioni di carattere generale riguardo a problemi di installazione e configurazione di osCommerce

Moderatore: mod Generali

Rispondi
foxhound
membro Baby
membro Baby
Messaggi: 65
Iscritto il: 29/02/2004, 1:00
Località: USA

info

Messaggio da foxhound »

Salve a tutti.
Quale contrib mi permette di far accumulare punti per un tot di spesa?
quale contrib mi permette di dare un omaggio per un tot di spesa?

Grazie anticipatamente per la vostra utilissima collaborazione.
lobotomia
membro Senior
membro Senior
Messaggi: 390
Iscritto il: 20/01/2005, 1:00
Località: Italia
Contatta:

Messaggio da lobotomia »

dangling carrot :D
Avatar utente
sanden
membro Regular
membro Regular
Messaggi: 158
Iscritto il: 28/10/2004, 0:00
Località: Italia
Contatta:

Messaggio da sanden »

cioè come funziona??? interessa anche a me.....
lobotomia
membro Senior
membro Senior
Messaggi: 390
Iscritto il: 20/01/2005, 1:00
Località: Italia
Contatta:

Messaggio da lobotomia »

funziona che puoi fare un regalo ogni x euro in carrello :D

Saluti
Avatar utente
sanden
membro Regular
membro Regular
Messaggi: 158
Iscritto il: 28/10/2004, 0:00
Località: Italia
Contatta:

Messaggio da sanden »

sai dove posso vedere un esempio?
sarebbe interessante poter regalare un prodotto presente nello store scelto da te.....
Avatar utente
sanden
membro Regular
membro Regular
Messaggi: 158
Iscritto il: 28/10/2004, 0:00
Località: Italia
Contatta:

Messaggio da sanden »

il file di testo non è chiaro, lo step3 dice di trovare e sostituire delle righe, ma non dice in quale file, ne sai qualcosa????
lobotomia
membro Senior
membro Senior
Messaggi: 390
Iscritto il: 20/01/2005, 1:00
Località: Italia
Contatta:

Messaggio da lobotomia »

mi incolli il i fle di istruzioni qui?
Avatar utente
sanden
membro Regular
membro Regular
Messaggi: 158
Iscritto il: 28/10/2004, 0:00
Località: Italia
Contatta:

Messaggio da sanden »

STEP 1:
-------

create the gifts table in the database. I'm not going to go into details of database admin here, just run the SQL in the free_gifts.sql file on your db.




STEP 2:
-------

modify your "shopping_cart.php" file.

on the line after

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SHOPPING_CART));

add the following code



//BOF dangling carrot v1.3







if ($cart->count_contents() > 0){

// find any free gifts, and remove invalid ones

$num_in_cart = $cart->show_total();

$products = $cart->get_products();

$gift_query = tep_db_query("SELECT fg.*, p.products_id, p.products_model, p.products_price, p.products_image, pd.products_name FROM free_gifts fg, products p
LEFT JOIN products_description pd ON (pd.products_id=fg.products_id)
WHERE pd.language_id = '".$languages_id."'
AND p.products_id = fg.products_id
ORDER BY fg.threshold ASC");

$threshold = 0;
$p=0;
$gift_price=0;
$gift_exists=0;

while ($gift = tep_db_fetch_array($gift_query)) {
// loop through the current gifts


if ($gift_exists == 0){
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
if ($products[$i]['id'] == $gift['products_id']) {
// gift already in cart
$gift_exists = $products[$i]['id'];
$gift_price = $gift['products_price'];
$deficit = $gift['threshold'] - $num_in_cart + $gift_price;
break;
} else {

$deficit = $gift['threshold'] - $num_in_cart;

}

}


}

else {


$deficit = $gift['threshold'] - $num_in_cart + $gift_price;
}


if ( $deficit < 20 && $deficit > 0 ) {
$near_limit = 1;
} else {
$near_limit = 0;
}



if ($num_in_cart >= $gift['threshold'] && $deficit <= 0) {
// cart could qualify for this gift

// check to see if in cart already
// add to gift list if not in cart


if ($gift['products_id'] != $gift_exists && $deficit <= 0) {
// this particular gift is not in cart but qualifies

$freebie[$p]['message'] .= 'By spending over '.$currencies->display_price($gift['threshold'],tep_get_tax_rate($gift['products_tax_class_id'])).' you have qualified for the following gift!';
//$freebie[$p]['link'] = '<a href="index.php?action=buy_now&products_id='.$gift['products_id'].'"><img src="images/button_select_now.gif" border="0"></a>';
$freebie[$p]['link'] = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $gift['products_id']) . '">' . tep_image_button('button_select_now.gif', 'Select ' . $gift['products_id'] . TEXT_NOW) . '</a>';
$freebie[$p]['name'] = $gift['products_name'];
$freebie[$p]['id'] = $gift['products_id'];
$freebie[$p]['image'] = $gift['products_image'];
//$freebie[$p]['price'] = $gift['products_trade_price'];

$p++;
}

}
else if ($near_limit) {
if ($gift['products_id'] != $gift_exists) {
// this particular gift is not in cart


$freebie[$p]['message'] .= '<font color="red">Spend just '. $currencies->display_price($deficit,tep_get_tax_rate($gift['products_tax_class_id'])).' more to get ...</font>';
$freebie[$p]['link'] = '';
$freebie[$p]['name'] = $gift['products_name'];
$freebie[$p]['id'] = $gift['products_id'];
$freebie[$p]['image'] = $gift['products_image'];
//$freebie[$p]['price'] = $gift['products_trade_price'];

$p++;
} else {
// cart cannot qualify for this gift
// remove if in cart

// $gift_message .= '<br><font color="red">The gift <i>'. $gift['products_name'] . '</i> is not allowed for orders under ' . $gift['threshold'] .'. It has been removed from your cart.</font>';
$cart->remove($gift['products_id']);

}



} else {
// cart cannot qualify for this gift
// remove if in cart

// $gift_message .= '<br><font color="red">The gift <i>'. $gift['products_name'] . '</i> is not allowed for orders under ' . $gift['threshold'] .'. It has been removed from your cart.</font>';
$cart->remove($gift['products_id']);

}
$threshold = $gift['threshold'];
}//while



}

//EOF dangling carrot v1.3





******
next, after this section:


<td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a>'; ?></td>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>



add the following code (near the end of your shopping_cart.php file).
It shows the current gifts available to the user



<!--BOF dangling carrot v1.3-->
<?php
if ($cart->count_contents() > 0){
?>
<tr><td>
<hr noshade width="100%" size="1">
<?php

if ($gift_message) {
echo '<div align="center"><span class="smallText">'.$gift_message.'</span></div><p>';
}

for ($i=0, $n=sizeof($freebie); $i<$n; $i++) {
if ($gift_exists > 0) {
$link = '<font color="red">Please remove other gifts/offers from your cart first</font>';
} else {
$link = $freebie[$i]['link'];
}
echo '<table width="100%" align="center" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td class="smallText" bgcolor="#FFFFFF">
<img src="'.DIR_WS_IMAGES.'/'.$freebie[$i]['image'].'" align="left">
'.$freebie[$i]['message'].'
<br><b>'.$freebie[$i]['name'].'</b>
<br>'.$link.'
<br>(Maximum 1 gift per order)
</td>
</tr>
</table>';

}

if ($freebie[0]['name']) {
echo '<hr noshade width="100%" size="1">';
}


?>
</td></tr>

<?php
}
?>


<!--EOF dangling carrot v1.3-->








******
next,FIND:
$products_name = '<table border="0" cellspacing="2" cellpadding="2">' .
' <tr>' .
' <td class="productListing-data" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' .
' <td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';


and replace with:


<!--BOF dangling carrot v1.3-->

if ($products[$i]['model'] == "gift"){
$products_name = '<table border="0" cellspacing="2" cellpadding="2">' .
' <tr>' .
' <td class="productListing-data" align="center">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</td>' .
' <td class="productListing-data" valign="top"><b>' . $products[$i]['name'] . '</b>';
}
else{
$products_name = '<table border="0" cellspacing="2" cellpadding="2">' .
' <tr>' .
' <td class="productListing-data" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' .
' <td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';

}




<!--EOF dangling carrot v1.3-->









******
next,FIND:

$info_box_contents[$cur_row][] = array('align' => 'center',
'params' => 'class="productListing-data" valign="top"',
'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));

And replace with:

<!--BOF dangling carrot v1.3-->

if ($products[$i]['model'] == "gift"){
$info_box_contents[$cur_row][] = array('align' => 'center',
'params' => 'class="productListing-data" valign="top"',
'text' => $products[$i]['quantity']. tep_draw_hidden_field('products_id[]', $products[$i]['id']));
}
else
{
$info_box_contents[$cur_row][] = array('align' => 'center',
'params' => 'class="productListing-data" valign="top"',
'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));
}


<!--EOF dangling carrot v1.3-->





****
that's it for the shopping_cart.php file!



STEP 3:
-------
Find:
$cart_contents_string .= $products[$i]['quantity'] . ' x </span></td><td valign="top" class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">';


And replace with:
if ($products[$i]['model'] == "gift")
{
$cart_contents_string .= $products[$i]['quantity'] . ' x </span></td><td valign="top" class="infoBoxContents">';
}
else {
$cart_contents_string .= $products[$i]['quantity'] . ' x </span></td><td valign="top" class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">';
}




Next Find:
$cart_contents_string .= $products[$i]['name'] . '</span></a></td></tr>';


And replace with:
if ($products[$i]['model'] == "gift")
{
$cart_contents_string .= $products[$i]['name'] . '</span></td></tr>';
}
else
{
$cart_contents_string .= $products[$i]['name'] . '</span></a></td></tr>';
}


STEP 4:
-------

add the admin page

copy the file "gift_add.php" into your /admin directory

add a link to it from your admin menu. take a look in /admin/includes/boxes/catalog.php and add the following:

'<a href="' . tep_href_link('gift_add.php', '', 'NONSSL') . '" class="menuBoxContentLink">Gifts</a><br>' .


just above


'<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, '', 'NONSSL') . '" class="menuBoxContentLink">' . BOX_CATALOG_CATEGORIES_PRODUCTS_ATTRIBUTES . '</a><br>' .



STEP 5:
-------

Upload into your images directory button_select_now.gif.
lobotomia
membro Senior
membro Senior
Messaggi: 390
Iscritto il: 20/01/2005, 1:00
Località: Italia
Contatta:

Messaggio da lobotomia »

provato nello stesso file precedente? (shopping_cart.php)
Avatar utente
sanden
membro Regular
membro Regular
Messaggi: 158
Iscritto il: 28/10/2004, 0:00
Località: Italia
Contatta:

Messaggio da sanden »

si non c'è......
lobotomia
membro Senior
membro Senior
Messaggi: 390
Iscritto il: 20/01/2005, 1:00
Località: Italia
Contatta:

Messaggio da lobotomia »

non ho idea :S
Rispondi