Henrique Flausino Postado Dezembro 10, 2008 Denunciar Share Postado Dezembro 10, 2008 Boa tarde. Caros. Estou utilizando o sistema em php para mostrar informação sobre pagamento. Preciso fazer com que a forma de pagamento à prazo só apareça quando o cliente clicar em pagamento parcelado. Segue abaixo código. Arquivo product_info.php<?php require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO); $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product_check = tep_db_fetch_array($product_check_query);?><!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"><html <?php echo HTML_PARAMS; ?>><head><meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"><title><?php echo TITLE; ?> - <?php echo $product_info['products_name']; ?></title><base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"><link rel="stylesheet" type="text/css" href="stylesheet.css"><script language="javascript"><!--function popupWindow(url) { window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le ft=150')}//--></script></head><body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"><!-- header //--><?php require(DIR_WS_INCLUDES . 'header.php'); ?><!-- header_eof //--><!-- body //--><table border="0" class="<?php echo MAIN_TABLE; ?>" cellspacing="0" cellpadding="0"><tr> <td rowspan="2" class="<?php echo BOX_WIDTH_TD_LEFT; ?>"><table border="0" class="<?php echo BOX_WIDTH_LEFT; ?>" cellspacing="0" cellpadding="0"><!-- left_navigation //--><?php require(DIR_WS_INCLUDES . 'column_left.php'); ?><!-- left_navigation_eof //--> </table></td><!-- body_text //--> <td class="<?php echo CONTENT_WIDTH_TD; ?>"><?php echo panel_top(); ?><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?> <?php if ($product_check['total'] < 1) {?><?php echo tep_draw_top();?><?php echo tep_draw_title_top();?> <?php echo TEXT_PRODUCT_NOT_FOUND; ?> <?php echo tep_draw_title_bottom();?> <?php echo tep_draw1_top();?> <?php echo tep_draw_infoBox2_top();?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr><td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td></tr> </table> <?php echo tep_draw_infoBox2_bottom();?><?php echo tep_draw1_bottom();?><?php } else { $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product_info = tep_db_fetch_array($product_info_query); tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'"); if ($new_price = tep_get_products_special_price($product_info['products_id'])) { $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>'; } else { $products_price = '<span class="productSpecialPrice">'.$currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])).'</span>'; } if (tep_not_null($product_info['products_model'])) { $products_name = $product_info['products_name'] . '<br> <span class="smallText">[' . $product_info['products_model'] . ']</span>'; } else { $products_name = $product_info['products_name']; }?><?php echo tep_draw_top();?><?php echo tep_draw_title_top();?> <div class="left_part"><?php echo $products_name; ?></div><div class="right_part" style="text-align:right;"><?php echo $products_price; ?></div> <?php echo tep_draw_title_bottom();?> <?php echo tep_draw1_top();?> <?php /* echo tep_draw2_top(); */ ?><?php echo tep_pixel_trans();?><?php if (tep_not_null($product_info['products_image'])) {?><div style="clear:both;"></div><?php }?><?php echo tep_pixel_trans();?> <?php /* echo tep_draw2_bottom(); */ ?> <div class="prod_line_x"><?php echo tep_draw_separator('spacer.gif', '1', '1'); ?></div> <?php echo tep_draw2_top();?><?php $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'"); $products_attributes = tep_db_fetch_array($products_attributes_query); if ($products_attributes['total'] > 0) {?><?php echo tep_pixel_trans();?><table border="0" cellspacing="4" cellpadding="2"> <tr> <td class="main" colspan="2"><strong><?php echo TEXT_PRODUCT_OPTIONS; ?></strong></td> </tr> <?php $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name"); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $products_options_array = array(); $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'"); while ($products_options = tep_db_fetch_array($products_options_query)) { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); if ($products_options['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } } if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) { $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]; } else { $selected_attribute = false; }?> <tr> <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td> <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td> </tr> <?php }?></table><?php }?><?php $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'"); $reviews = tep_db_fetch_array($reviews_query); if ($reviews['count'] > 0) {?><?php } else { ?><table border="0" cellspacing="4" cellpadding="2"> <tr> <td class="main" colspan="2"> </td> </tr> <?php $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name"); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $products_options_array = array(); $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'"); while ($products_options = tep_db_fetch_array($products_options_query)) { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); if ($products_options['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } } if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) { $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]; } else { $selected_attribute = false; }?> <?php }?></table><table border="0"> <tr> <td><div class="main" style="float:left;padding:1px 1px 1px 1px;margin:0px 20px 0px 0px; text-align:center; width:<?php echo (SMALL_IMAGE_WIDTH +2);?>px;"> <?php echo tep_draw_prod_pic_top();?> <script language="javascript"><!--document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, '') . '</a>'; ?>');//--></script> <noscript> <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, '') . '</a>'; ?> </noscript> <?php echo tep_draw_prod_pic_bottom();?> <script language="javascript"><!--document.write('<?php echo '<a class="enlarge" href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');//--></script> <noscript> <?php echo '<a class="enlarge" href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?> </noscript> </div></td> <td > <?php include_once("pag_digital.php");?> <? if ($new_price = tep_get_products_special_price($product_info['products_id'])) { ?> <?=splitCredit($new_price); } else { ?> <?=splitCredit($product_info['products_price']); }?> <?php } if (tep_not_null($product_info['products_url'])) {?></td> </tr></table> <table cellpadding="0" cellspacing="4" border="0"> <tr> <td height="37" class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td> </tr> </table><?php echo tep_pixel_trans();?><?php }?> <?php echo tep_draw2_bottom();?> <?php if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {?><?php echo tep_pixel_trans();?> <table cellpadding="0" cellspacing="4" border="0"> <tr> <td class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td> </tr> </table><?php } else {?><?php echo tep_pixel_trans();?><?php }?> <?php echo tep_pixel_trans();?> <?php /* echo tep_draw2_top(); */ ?><?php echo tep_pixel_trans();?><?php echo tep_draw_infoBox2_top(); ?><table width="100%" border="0" bgcolor="#FF0000"> <tr> <td class="descricao"><img src="images/infobox/arrow_right.gif" width="12" height="10"> Descrição do produto</td> </tr></table><table class="tbdescricao"><tr><td><div class="main"><?php echo stripslashes($product_info['products_description']); ?><br> <br> <?php echo $products_price?> </div></td></tr></table> <table width="100%" border="0"> <tr> <td class="main button_marg"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td> <td class="main button_marg" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_add_to_cart1.gif', IMAGE_BUTTON_IN_CART); ?></td> </tr> </table> <?php echo tep_draw_infoBox2_bottom(); ?> <?php /* echo tep_draw2_bottom(); */ ?> <?php echo tep_draw1_bottom();?> <?php if ((USE_CACHE == 'true') && empty($SID)) { echo tep_cache_also_purchased(3600); } else { include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS); } }?> <?php echo tep_draw_bottom();?> </form></div></td><!-- body_text_eof //--> <td rowspan="2" class="<?php echo BOX_WIDTH_TD_RIGHT; ?>"><table border="0" class="<?php echo BOX_WIDTH_RIGHT; ?>" cellspacing="0" cellpadding="0"><!-- right_navigation //--><?php require(DIR_WS_INCLUDES . 'column_right.php'); ?><!-- right_navigation_eof //--> </table></td> </tr><tr> <td colspan="2" class="<?php echo CONTENT_WIDTH_TD; ?>"> </td></tr></table><!-- body_eof //--><!-- footer //--><?php require(DIR_WS_INCLUDES . 'footer.php'); ?><!-- footer_eof //--></body></html><?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Arquivo pag_digital.php <?phpfunction splitCredit($totalValue){////////////////////////////////////////////////////////////////////////////////////////////////////////// ESTA PARTE PODE SER ALTERADA $minvalor = 1.00; // VALOR MINIMO DE CADA PARCELA$desconto = 0;//Valor da percentagem de Desconto atribuída ao produto$parcelaqtminimacc = '24'; ///QUANTIDADE MÁXIMA DE PARCELAS$taxaboleto = '0'; // TAXA DO BOLETO (zero se não cobrar esta taxa)$tablewidth = '0'; // tamanho da largura da tabela padrão 280$desconto = '0.06';/////////////////////////////////////////$splits = (int) ($totalValue/$minvalor);$valor = ( $totalValue / ($i+1) );$totaldesconto = $valor - (($desconto/100)*$valor);$minSemJuroscc = 1;$table= '<table width="400" class="tbdescricao" cellpadding="0" cellspacing="0"> <tr> <td colspan="3" align="center"><span class="headtop">FORMAS DE PAGAMENTO</span></td> </tr> <tr height="5"> <td colspan="3"></td> </tr><tr height="5"> <td class="res1" bgcolor="#CCCCCC">Forma de Pagamento</td> <td class="res1" bgcolor="#999999">Valor<br />Parcelado</td> <td class="res1" bgcolor="#999999">Total<br />Parcelado</td> </tr><tr height="5"> <td></td> <td></td> <td></td> </tr> <tr> <td colspan="3" bgcolor="#FF0000" align="center" class="descricao">Pagamento à vista</td> </tr>'; $table .= '<tr height="5"> <td></td> <td></td> <td></td> </tr>';$table .= '<tr> <td class="res1" bgcolor="#FFC6C6">Depósito ou<br>Transferência Bancária</td> <td class="res1" bgcolor="#FF9999">R$ '. number_format($totalValue-$totalValue*$desconto+$taxa0 , 2 , "," , ".") .'</td> <td class="res1" bgcolor="#FF9999">R$ '. number_format($totalValue-$totalValue*$desconto+$taxa0*1 , 2 , "," , ".") .'</td> </tr> </div>'; $parcela = $valor - (($desconto/100)*$valor); $table .= '<tr height="1"> <td></td> <td></td> <td></td> </tr>'; //$table .= '<tr> // <td class="res2">Deposito HSBC</td> // <td class="res2">R$ '. number_format($totalValue+$taxa0 , 2 , "," , ".") .'</td> // <td class="res2"><b>R$ '. number_format($totalValue+$taxa0*1 , 2 , "," , ".") .'</></td> // </tr>'; //$parcela = $valor - (($desconto/100)*$valor); //$table .= '<tr> // <td class="res1">Deposito Nossa Caixa</td> // <td class="res1">R$ '. number_format($totalValue+$taxa0 , 2 , "," , ".") .'</td> // <td class="res1"><b>R$ '. number_format($totalValue+$taxa0*1 , 2 , "," , ".") .'</b></td> // </tr>'; $parcela = $valor - (($desconto/100)*$valor); $table .= '<tr> <td class="res2" bgcolor="#FFC6C6"><b>Boleto Bancário</b></td> <td class="res2" bgcolor="#FF9999" ><b>R$ '. number_format($totalValue+$taxa1+$taxaboleto , 2 , "," , ".") .'</b></td> <td class="res2" bgcolor="#FF9999"><b>R$ '. number_format($totalValue+$taxa1+$taxaboleto*1 , 2 , "," , ".") .'</b></td> </tr>'; $table .= '<tr height="5"> <td></td> <td></td> <td></td> </tr>'; $table .= '<tr height="5"> <td colspan="3" bgcolor="#FF0000" align="center" class="descricao">Pagamento parcelado</td> </tr>'; $table .= '<tr height="5"> <td></td> <td></td> <td></td> </tr>';########################################################################### ###//1 vez sem juros $table .= '<tr> <td class="prazo1"><b><font color="FF0000">1x Sem juros</font></b></td> <td class="prazo2"><b><font color="FF0000">R$ '. number_format($totalValue/1 , 2 , "," , ".") .'</font></b></td> <td class="prazo2"><b><font color="FF0000">R$ '. number_format($totalValue/2*2 , 2 , "," , ".") .'</font></b></td> </tr>';// fim de 1 vez sem jurosfor($i = 0; $i < $splits; $i++){if($i>$parcelaqtminimacc - 1){break;}$i % 2 == 0 ? $class = "res1" : $class = "res2";if($i=='0'){ $parcela = $valor - (($desconto/100)*$valor); }////////////////////////////ATUALIZADO POR BYTESDESIGN.COM//////////////if($i+1=='2'){$taxa = 0.5200980;}// MULTIPLICADOR DA 2ª PARCELAif($i+1=='3'){$taxa = 0.3536320;} // MULTIPLICADOR DA 3ª PARCELAif($i+1=='4'){$taxa = 0.2705019;} // MULTIPLICADOR DA 4ª PARCELAif($i+1=='5'){$taxa = 0.2207079;} // MULTIPLICADOR DA 5ª PARCELAif($i+1=='6'){$taxa = 0.1875834;} // MULTIPLICADOR DA 6ª PARCELAif($i+1=='7'){$taxa = 0.1639854;} // MULTIPLICADOR DA 7ª PARCELAif($i+1=='8'){$taxa = 0.1463426;} // MULTIPLICADOR DA 8ª PARCELAif($i+1=='9'){$taxa = 0.1326709;} // MULTIPLICADOR DA 9ª PARCELAif($i+1=='10'){$taxa = 0.1217800;} // MULTIPLICADOR DA 10ª PARCELAif($i+1=='11'){$taxa = 0.1129122;} // MULTIPLICADOR DA 10ª PARCELAif($i+1=='12'){$taxa = 0.1055625;} // MULTIPLICADOR DA 12ª PARCELAif($i+1=='13'){$taxa = 0.0993815;} // MULTIPLICADOR DA 13ª PARCELAif($i+1=='14'){$taxa = 0.0941192;} // MULTIPLICADOR DA 14ª PARCELAif($i+1=='15'){$taxa = 0.0895927;} // MULTIPLICADOR DA 15ª PARCELAif($i+1=='16'){$taxa = 0.0856646;} // MULTIPLICADOR DA 16ª PARCELAif($i+1=='17'){$taxa = 0.0822300;} // MULTIPLICADOR DA 17ª PARCELAif($i+1=='18'){$taxa = 0.0792071;} // MULTIPLICADOR DA 18ª PARCELAif($i+1=='19'){$taxa = 0.0765316;} // MULTIPLICADOR DA 19ª PARCELAif($i+1=='20'){$taxa = 0.0741518;} // MULTIPLICADOR DA 20ª PARCELAif($i+1=='21'){$taxa = 0.0720261;} // MULTIPLICADOR DA 21ª PARCELAif($i+1=='22'){$taxa = 0.0701204;} // MULTIPLICADOR DA 22ª PARCELAif($i+1=='23'){$taxa = 0.0684064;} // MULTIPLICADOR DA 23ª PARCELAif($i+1=='24'){$taxa = 0.0668607;} // MULTIPLICADOR DA 24ª PARCELA// jean *********// $minvalor = 1.00;// echo $totalValue*$taxa.'/';// jean ***********if($i == $minSemJuroscc){$table .= '<tr height="3"> <td></td> <td></td> <td></td> </tr>';$table .= '<tr><td class="prazo1">'. ($i+1) . 'x com juros*</td><td class="prazo2">R$ '. number_format($totalValue*$taxa , 2 , "," , ".") . '</font></b></td><td class="prazo2">R$ '. number_format($totalValue*$taxa*($i+1), 2 , "," , ".").'</td></tr>';}else{if (($totalValue*$taxa) > $minvalor){$valor = ( $totalValue / ($i+1) );$table .= '<tr height="3"> <td></td> <td></td> <td></td> </tr>';$table .= '<tr><td class="prazo1"> '. ($i+1) . 'x com juros*</td><td class="prazo2">R$ '. number_format($totalValue*$taxa , 2 , "," , ".") .'</td><td class="prazo2">R$ '. number_format($totalValue*$taxa*($i+1) , 2 , "," , ".") .'</td></tr>';}}}$table .= "</table>"; $table .= '<table width="' .$tablewidth. '" style="border: 0px dotted #ff0000;" cellpadding="0" cellspacing="0"><tr><td class="res4" align="left">*Parcelado em 2 vezes ou mais, juros de 1.99% ao mês<br /><font color="#FF0000"><b>Parcelado em até 10X nos cartões Visa e Diners</b></font><br /><b>Parcelado em até 12X nos cartões Mastercard e HiperCard</b><br /><font color="#FF0000"><b>Parcelado em até 15X no cartão American Express</font></b><br />Parcelado em até 24X no cartão Aura</tr></td></table>'; return $table;}?><style>.headtop{font-family:'Verdana';font-size:12px;font-weight:bold;text-align:center;color:#0000FF;}.head{font-family:'Verdana';font-size:10px;background-color:#F1F1F1;font-weight:bold;text-align:center;color:#333333;border:1px solid #ffffff;}.head2{font-family:'Verdana';font-size:10px;background-color:#c9c8b4;font-weight:bold;text-align:center;color:#333333;border:1px solid #ffffff;}.res1{font-family:'Verdana';font-size:10px;text-align:center;color:#000000;border:1px solid #ffffff;}.prazo1{background-color:#E1E1E1;font-family:'Verdana';font-size:10px;text-align:center;color:#000000;border:1px solid #ffffff;}.prazo2{background-color:#C5C5C5;font-family:'Verdana';font-size:10px;text-align:center;color:#000000;border:1px solid #ffffff;}.res2{font-family:'Verdana';font-size:10px;text-align:center;color:#000000;border:1px solid #ffffff;}.res4{font-family:'Verdana';font-size:9px;background-color:#ffffff;font-weight:bold;text-align:center;color:#666666;}</style>Agradeço desde já pela atenção.Henrique Flausino Citar Link para o comentário Compartilhar em outros sites More sharing options...
0 ESerra Postado Dezembro 10, 2008 Denunciar Share Postado Dezembro 10, 2008 OSCommerce? O que você quer é ocultar/exibir isso com JS? Ou com um link para verificar com ISSET no PHP? Citar Link para o comentário Compartilhar em outros sites More sharing options...
0 Henrique Flausino Postado Dezembro 10, 2008 Autor Denunciar Share Postado Dezembro 10, 2008 OSCommerce? O que você quer é ocultar/exibir isso com JS? Ou com um link para verificar com ISSET no PHP?Olá ESerra.Não tenho preferencia por função.Preciso mesmo é ocultar/exibir.Tentei uma função do CS4 mas não funcionou, pois como pode ver os valores são dinamicos.Função utilizada> SprySe me passar um js acredito que seja melhor.Atenciosamente.Henrique Flausino Citar Link para o comentário Compartilhar em outros sites More sharing options...
0 Henrique Flausino Postado Dezembro 15, 2008 Autor Denunciar Share Postado Dezembro 15, 2008 Consegui... :rolleyes: :lol: :D Segue abaixo código caso alguém precise.Arquivo:product_info.php<?php ###################################### #/* # #Editado por Henrique Flausino # #Data do projeto 15/12/2008 # #Contato: rique_tec@ig.com.br # #*/ # ###################################### require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO); $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product_check = tep_db_fetch_array($product_check_query); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?> - <?php echo $product_info['products_name']; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> <script src="SpryAssets/SpryCollapsiblePanel.js" type="text/javascript"></script> <link href="SpryAssets/SpryCollapsiblePanel.css" rel="stylesheet" type="text/css" /> <script language="javascript"><!-- function popupWindow(url) { window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le ft=150') } //--></script> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" class="<?php echo MAIN_TABLE; ?>" cellspacing="0" cellpadding="0"> <tr> <td rowspan="2" class="<?php echo BOX_WIDTH_TD_LEFT; ?>"><table border="0" class="<?php echo BOX_WIDTH_LEFT; ?>" cellspacing="0" cellpadding="0"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td class="<?php echo CONTENT_WIDTH_TD; ?>"><?php echo panel_top(); ?><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?> <?php if ($product_check['total'] < 1) { ?> <?php echo tep_draw_top();?> <?php echo tep_draw_title_top();?> <?php echo TEXT_PRODUCT_NOT_FOUND; ?> <?php echo tep_draw_title_bottom();?> <?php echo tep_draw1_top();?> <?php echo tep_draw_infoBox2_top();?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr><td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td></tr> </table> <?php echo tep_draw_infoBox2_bottom();?> <?php echo tep_draw1_bottom();?> <?php } else { $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product_info = tep_db_fetch_array($product_info_query); tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'"); if ($new_price = tep_get_products_special_price($product_info['products_id'])) { $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>'; } else { $products_price = '<span class="productSpecialPrice">'.$currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])).'</span>'; } if (tep_not_null($product_info['products_model'])) { $products_name = $product_info['products_name'] . '<br> <span class="smallText">[' . $product_info['products_model'] . ']</span>'; } else { $products_name = $product_info['products_name']; } ?> <?php echo tep_draw_top();?> <?php echo tep_draw_title_top();?> <div class="left_part"><?php echo $products_name; ?></div><div class="right_part" style="text-align:right;"><?php echo $products_price; ?></div> <?php echo tep_draw_title_bottom();?> <?php echo tep_draw1_top();?> <?php /* echo tep_draw2_top(); */ ?> <?php echo tep_pixel_trans();?> <?php if (tep_not_null($product_info['products_image'])) { ?> <div style="clear:both;"></div> <?php } ?> <?php echo tep_pixel_trans();?> <?php /* echo tep_draw2_bottom(); */ ?> <div class="prod_line_x"><?php echo tep_draw_separator('spacer.gif', '1', '1'); ?></div> <?php echo tep_draw2_top();?> <?php $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'"); $products_attributes = tep_db_fetch_array($products_attributes_query); if ($products_attributes['total'] > 0) { ?> <?php echo tep_pixel_trans();?> <table border="0" cellspacing="4" cellpadding="2"> <tr> <td class="main" colspan="2"><strong><?php echo TEXT_PRODUCT_OPTIONS; ?></strong></td> </tr> <?php $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name"); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $products_options_array = array(); $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'"); while ($products_options = tep_db_fetch_array($products_options_query)) { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); if ($products_options['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } } if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) { $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]; } else { $selected_attribute = false; } ?> <tr> <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td> <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td> </tr> <?php } ?> </table> <?php } ?> <?php $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'"); $reviews = tep_db_fetch_array($reviews_query); if ($reviews['count'] > 0) { ?> <?php } else { ?> <table border="0" cellspacing="4" cellpadding="2"> <tr> <td class="main" colspan="2"> </td> </tr> <?php $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name"); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $products_options_array = array(); $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'"); while ($products_options = tep_db_fetch_array($products_options_query)) { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); if ($products_options['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } } if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) { $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]; } else { $selected_attribute = false; } ?> <?php } ?> </table> <table border="0"> <tr> <td><div class="main" style="float:left;padding:1px 1px 1px 1px;margin:0px 20px 0px 0px; text-align:center; width:<?php echo (SMALL_IMAGE_WIDTH +2);?>px;"> <?php echo tep_draw_prod_pic_top();?> <script language="javascript"><!-- document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, '') . '</a>'; ?>'); //--></script> <noscript> <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, '') . '</a>'; ?> </noscript> <?php echo tep_draw_prod_pic_bottom();?> <script language="javascript"><!-- document.write('<?php echo '<a class="enlarge" href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>'); //--></script> <noscript> <?php echo '<a class="enlarge" href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?> </noscript> </div></td> <td > <?php include_once("pag_digital.php");?> <? if ($new_price = tep_get_products_special_price($product_info['products_id'])) { ?> <?=splitCredit($new_price); } else { ?> <?=splitCredit($product_info['products_price']); }?> <?php } if (tep_not_null($product_info['products_url'])) { ?></td> </tr> </table> <table cellpadding="0" cellspacing="4" border="0"> <tr> <td height="37" class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?> </td> </tr> </table> <?php echo tep_pixel_trans();?> <?php } ?> <?php echo tep_draw2_bottom();?> <?php if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) { ?> <?php echo tep_pixel_trans();?> <table cellpadding="0" cellspacing="4" border="0"> <tr> <td class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td> </tr> </table> <?php } else { ?> <?php echo tep_pixel_trans();?> <?php } ?> <?php echo tep_pixel_trans();?> <?php /* echo tep_draw2_top(); */ ?> <?php echo tep_pixel_trans();?> <?php echo tep_draw_infoBox2_top(); ?> <table width="100%" border="0" bgcolor="#FF0000"> <tr> <td class="descricao"><img src="images/infobox/arrow_right.gif" width="12" height="10"> Descrição do produto</td> </tr> </table> <table class="tbdescricao"> <tr> <td> <div class="main"><?php echo stripslashes($product_info['products_description']); ?><br> <br> <?php echo $products_price?> </div></td></tr></table> <table width="100%" border="0"> <tr> <td class="main button_marg"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td> <td class="main button_marg" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_add_to_cart1.gif', IMAGE_BUTTON_IN_CART); ?></td> </tr> </table> <?php echo tep_draw_infoBox2_bottom(); ?> <?php /* echo tep_draw2_bottom(); */ ?> <?php echo tep_draw1_bottom();?> <?php if ((USE_CACHE == 'true') && empty($SID)) { echo tep_cache_also_purchased(3600); } else { include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS); } } ?> <?php echo tep_draw_bottom();?> </form> </div></td> <!-- body_text_eof //--> <td rowspan="2" class="<?php echo BOX_WIDTH_TD_RIGHT; ?>"><table border="0" class="<?php echo BOX_WIDTH_RIGHT; ?>" cellspacing="0" cellpadding="0"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> <tr> <td colspan="2" class="<?php echo CONTENT_WIDTH_TD; ?>"> </td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> SpryCollapsiblePanel.js /* Desenvolvido por Henrique Flausino Data do projeto 15/12/2008 Contato: rique_tec@ig.com.br */ var Spry; if (!Spry) Spry = {}; if (!Spry.Widget) Spry.Widget = {}; Spry.Widget.CollapsiblePanel = function(element, opts) { this.element = this.getElement(element); this.focusElement = null; this.hoverClass = "CollapsiblePanelTabHover"; this.openClass = "CollapsiblePanelOpen"; this.closedClass = "CollapsiblePanelClosed"; this.focusedClass = "CollapsiblePanelFocused"; this.enableAnimation = true; this.enableKeyboardNavigation = true; this.animator = null; this.hasFocus = false; this.contentIsOpen = true; this.openPanelKeyCode = Spry.Widget.CollapsiblePanel.KEY_DOWN; this.closePanelKeyCode = Spry.Widget.CollapsiblePanel.KEY_UP; Spry.Widget.CollapsiblePanel.setOptions(this, opts); this.attachBehaviors(); }; Spry.Widget.CollapsiblePanel.prototype.getElement = function(ele) { if (ele && typeof ele == "string") return document.getElementById(ele); return ele; }; Spry.Widget.CollapsiblePanel.prototype.addClassName = function(ele, className) { if (!ele || !className || (ele.className && ele.className.search(new RegExp("\\b" + className + "\\b")) != -1)) return; ele.className += (ele.className ? " " : "") + className; }; Spry.Widget.CollapsiblePanel.prototype.removeClassName = function(ele, className) { if (!ele || !className || (ele.className && ele.className.search(new RegExp("\\b" + className + "\\b")) == -1)) return; ele.className = ele.className.replace(new RegExp("\\s*\\b" + className + "\\b", "g"), ""); }; Spry.Widget.CollapsiblePanel.prototype.hasClassName = function(ele, className) { if (!ele || !className || !ele.className || ele.className.search(new RegExp("\\b" + className + "\\b")) == -1) return false; return true; }; Spry.Widget.CollapsiblePanel.prototype.setDisplay = function(ele, display) { if( ele ) ele.style.display = display; }; Spry.Widget.CollapsiblePanel.setOptions = function(obj, optionsObj, ignoreUndefinedProps) { if (!optionsObj) return; for (var optionName in optionsObj) { if (ignoreUndefinedProps && optionsObj[optionName] == undefined) continue; obj[optionName] = optionsObj[optionName]; } }; Spry.Widget.CollapsiblePanel.prototype.onTabMouseOver = function(e) { this.addClassName(this.getTab(), this.hoverClass); return false; }; Spry.Widget.CollapsiblePanel.prototype.onTabMouseOut = function(e) { this.removeClassName(this.getTab(), this.hoverClass); return false; }; Spry.Widget.CollapsiblePanel.prototype.open = function() { this.contentIsOpen = true; if (this.enableAnimation) { if (this.animator) this.animator.stop(); this.animator = new Spry.Widget.CollapsiblePanel.PanelAnimator(this, true, { duration: this.duration, fps: this.fps, transition: this.transition }); this.animator.start(); } else this.setDisplay(this.getContent(), "block"); this.removeClassName(this.element, this.closedClass); this.addClassName(this.element, this.openClass); }; Spry.Widget.CollapsiblePanel.prototype.close = function() { this.contentIsOpen = false; if (this.enableAnimation) { if (this.animator) this.animator.stop(); this.animator = new Spry.Widget.CollapsiblePanel.PanelAnimator(this, false, { duration: this.duration, fps: this.fps, transition: this.transition }); this.animator.start(); } else this.setDisplay(this.getContent(), "none"); this.removeClassName(this.element, this.openClass); this.addClassName(this.element, this.closedClass); }; Spry.Widget.CollapsiblePanel.prototype.onTabClick = function(e) { if (this.isOpen()) this.close(); else this.open(); this.focus(); return this.stopPropagation(e); }; Spry.Widget.CollapsiblePanel.prototype.onFocus = function(e) { this.hasFocus = true; this.addClassName(this.element, this.focusedClass); return false; }; Spry.Widget.CollapsiblePanel.prototype.onBlur = function(e) { this.hasFocus = false; this.removeClassName(this.element, this.focusedClass); return false; }; Spry.Widget.CollapsiblePanel.KEY_UP = 38; Spry.Widget.CollapsiblePanel.KEY_DOWN = 40; Spry.Widget.CollapsiblePanel.prototype.onKeyDown = function(e) { var key = e.keyCode; if (!this.hasFocus || (key != this.openPanelKeyCode && key != this.closePanelKeyCode)) return true; if (this.isOpen() && key == this.closePanelKeyCode) this.close(); else if ( key == this.openPanelKeyCode) this.open(); return this.stopPropagation(e); }; Spry.Widget.CollapsiblePanel.prototype.stopPropagation = function(e) { if (e.preventDefault) e.preventDefault(); else e.returnValue = false; if (e.stopPropagation) e.stopPropagation(); else e.cancelBubble = true; return false; }; Spry.Widget.CollapsiblePanel.prototype.attachPanelHandlers = function() { var tab = this.getTab(); if (!tab) return; var self = this; Spry.Widget.CollapsiblePanel.addEventListener(tab, "click", function(e) { return self.onTabClick(e); }, false); Spry.Widget.CollapsiblePanel.addEventListener(tab, "mouseover", function(e) { return self.onTabMouseOver(e); }, false); Spry.Widget.CollapsiblePanel.addEventListener(tab, "mouseout", function(e) { return self.onTabMouseOut(e); }, false); if (this.enableKeyboardNavigation) { var tabIndexEle = null; var tabAnchorEle = null; this.preorderTraversal(tab, function(node) { if (node.nodeType == 1) { var tabIndexAttr = tab.attributes.getNamedItem("tabindex"); if (tabIndexAttr) { tabIndexEle = node; return true; } if (!tabAnchorEle && node.nodeName.toLowerCase() == "a") tabAnchorEle = node; } return false; }); if (tabIndexEle) this.focusElement = tabIndexEle; else if (tabAnchorEle) this.focusElement = tabAnchorEle; if (this.focusElement) { Spry.Widget.CollapsiblePanel.addEventListener(this.focusElement, "focus", function(e) { return self.onFocus(e); }, false); Spry.Widget.CollapsiblePanel.addEventListener(this.focusElement, "blur", function(e) { return self.onBlur(e); }, false); Spry.Widget.CollapsiblePanel.addEventListener(this.focusElement, "keydown", function(e) { return self.onKeyDown(e); }, false); } } }; Spry.Widget.CollapsiblePanel.addEventListener = function(element, eventType, handler, capture) { try { if (element.addEventListener) element.addEventListener(eventType, handler, capture); else if (element.attachEvent) element.attachEvent("on" + eventType, handler); } catch (e) {} }; Spry.Widget.CollapsiblePanel.prototype.preorderTraversal = function(root, func) { var stopTraversal = false; if (root) { stopTraversal = func(root); if (root.hasChildNodes()) { var child = root.firstChild; while (!stopTraversal && child) { stopTraversal = this.preorderTraversal(child, func); try { child = child.nextSibling; } catch (e) { child = null; } } } } return stopTraversal; }; Spry.Widget.CollapsiblePanel.prototype.attachBehaviors = function() { var panel = this.element; var tab = this.getTab(); var content = this.getContent(); if (this.contentIsOpen || this.hasClassName(panel, this.openClass)) { this.addClassName(panel, this.openClass); this.removeClassName(panel, this.closedClass); this.setDisplay(content, "block"); this.contentIsOpen = true; } else { this.removeClassName(panel, this.openClass); this.addClassName(panel, this.closedClass); this.setDisplay(content, "none"); this.contentIsOpen = false; } this.attachPanelHandlers(); }; Spry.Widget.CollapsiblePanel.prototype.getTab = function() { return this.getElementChildren(this.element)[0]; }; Spry.Widget.CollapsiblePanel.prototype.getContent = function() { return this.getElementChildren(this.element)[1]; }; Spry.Widget.CollapsiblePanel.prototype.isOpen = function() { return this.contentIsOpen; }; Spry.Widget.CollapsiblePanel.prototype.getElementChildren = function(element) { var children = []; var child = element.firstChild; while (child) { if (child.nodeType == 1) children.push(child); child = child.nextSibling; } return children; }; Spry.Widget.CollapsiblePanel.prototype.focus = function() { if (this.focusElement && this.focusElement.focus) this.focusElement.focus(); }; Spry.Widget.CollapsiblePanel.PanelAnimator = function(panel, doOpen, opts) { this.timer = null; this.interval = 0; this.fps = 60; this.duration = 500; this.startTime = 0; this.transition = Spry.Widget.CollapsiblePanel.PanelAnimator.defaultTransition; this.onComplete = null; this.panel = panel; this.content = panel.getContent(); this.doOpen = doOpen; Spry.Widget.CollapsiblePanel.setOptions(this, opts, true); this.interval = Math.floor(1000 / this.fps); var c = this.content; var curHeight = c.offsetHeight ? c.offsetHeight : 0; this.fromHeight = (doOpen && c.style.display == "none") ? 0 : curHeight; if (!doOpen) this.toHeight = 0; else { if (c.style.display == "none") { c.style.visibility = "hidden"; c.style.display = "block"; } c.style.height = ""; this.toHeight = c.offsetHeight; } this.distance = this.toHeight - this.fromHeight; this.overflow = c.style.overflow; c.style.height = this.fromHeight + "px"; c.style.visibility = "visible"; c.style.overflow = "hidden"; c.style.display = "block"; }; Spry.Widget.CollapsiblePanel.PanelAnimator.defaultTransition = function(time, begin, finish, duration) { time /= duration; return begin + ((2 - time) * time * finish); }; Spry.Widget.CollapsiblePanel.PanelAnimator.prototype.start = function() { var self = this; this.startTime = (new Date).getTime(); this.timer = setTimeout(function() { self.stepAnimation(); }, this.interval); }; Spry.Widget.CollapsiblePanel.PanelAnimator.prototype.stop = function() { if (this.timer) { clearTimeout(this.timer); this.content.style.overflow = this.overflow; } this.timer = null; }; Spry.Widget.CollapsiblePanel.PanelAnimator.prototype.stepAnimation = function() { var curTime = (new Date).getTime(); var elapsedTime = curTime - this.startTime; if (elapsedTime >= this.duration) { if (!this.doOpen) this.content.style.display = "none"; this.content.style.overflow = this.overflow; this.content.style.height = this.toHeight + "px"; if (this.onComplete) this.onComplete(); return; } var ht = this.transition(elapsedTime, this.fromHeight, this.distance, this.duration); this.content.style.height = ((ht < 0) ? 0 : ht) + "px"; var self = this; this.timer = setTimeout(function() { self.stepAnimation(); }, this.interval); }; Spry.Widget.CollapsiblePanelGroup = function(element, opts) { this.element = this.getElement(element); this.opts = opts; this.attachBehaviors(); }; Spry.Widget.CollapsiblePanelGroup.prototype.setOptions = Spry.Widget.CollapsiblePanel.prototype.setOptions; Spry.Widget.CollapsiblePanelGroup.prototype.getElement = Spry.Widget.CollapsiblePanel.prototype.getElement; Spry.Widget.CollapsiblePanelGroup.prototype.getElementChildren = Spry.Widget.CollapsiblePanel.prototype.getElementChildren; Spry.Widget.CollapsiblePanelGroup.prototype.setElementWidget = function(element, widget) { if (!element || !widget) return; if (!element.spry) element.spry = new Object; element.spry.collapsiblePanel = widget; }; Spry.Widget.CollapsiblePanelGroup.prototype.getElementWidget = function(element) { return (element && element.spry && element.spry.collapsiblePanel) ? element.spry.collapsiblePanel : null; }; Spry.Widget.CollapsiblePanelGroup.prototype.getPanels = function() { if (!this.element) return []; return this.getElementChildren(this.element); }; Spry.Widget.CollapsiblePanelGroup.prototype.getPanel = function(panelIndex) { return this.getPanels()[panelIndex]; }; Spry.Widget.CollapsiblePanelGroup.prototype.attachBehaviors = function() { if (!this.element) return; var cpanels = this.getPanels(); var numCPanels = cpanels.length; for (var i = 0; i < numCPanels; i++) { var cpanel = cpanels[i]; this.setElementWidget(cpanel, new Spry.Widget.CollapsiblePanel(cpanel, this.opts)); } }; Spry.Widget.CollapsiblePanelGroup.prototype.openPanel = function(panelIndex) { var w = this.getElementWidget(this.getPanel(panelIndex)); if (w && !w.isOpen()) w.open(); }; Spry.Widget.CollapsiblePanelGroup.prototype.closePanel = function(panelIndex) { var w = this.getElementWidget(this.getPanel(panelIndex)); if (w && w.isOpen()) w.close(); }; Spry.Widget.CollapsiblePanelGroup.prototype.openAllPanels = function() { var cpanels = this.getPanels(); var numCPanels = cpanels.length; for (var i = 0; i < numCPanels; i++) { var w = this.getElementWidget(cpanels[i]); if (w && !w.isOpen()) w.open(); } }; Spry.Widget.CollapsiblePanelGroup.prototype.closeAllPanels = function() { var cpanels = this.getPanels(); var numCPanels = cpanels.length; for (var i = 0; i < numCPanels; i++) { var w = this.getElementWidget(cpanels[i]); if (w && w.isOpen()) w.close(); } }; Pag_digital.php Obs: calculo feito com base de juros de 1.99% <?php ###################################### #/* # #Desenvolvido por Henrique Flausino # #Data do projeto 15/12/2008 # #Contato: rique_tec@ig.com.br # #*/ # ###################################### function splitCredit($totalValue){ $minvalor = 1.00; $desconto = 0; $parcelaqtminimacc = '24'; $taxaboleto = '0'; $tablewidth = '0'; $desconto = '0.06'; $splits = (int) ($totalValue/$minvalor); $valor = ( $totalValue / ($i+1) ); $totaldesconto = $valor - (($desconto/100)*$valor); $minSemJuroscc = 1; $table= '<table width="400" class="tbdescricao" cellpadding="0" cellspacing="0"> <tr> <td colspan="3" align="center"><span class="headtop">FORMAS DE PAGAMENTO</span></td> </tr> <tr height="5"> <td></td> <td></td> <td></td> </tr> <tr> <td colspan="3" bgcolor="#FF0000" align="center" class="descricao">Pagamento à vista</td> </tr>'; $table .= '<tr height="5"> <td></td> <td></td> <td></td> </tr>'; $table .= '<tr> <td class="res1" bgcolor="#FFC6C6">Depósito ou<br>Transferência Bancária</td> <td class="res1" bgcolor="#FF9999">R$ '. number_format($totalValue-$totalValue*$desconto+$taxa0 , 2 , "," , ".") .'</td> <td class="res1" bgcolor="#FF9999">R$ '. number_format($totalValue-$totalValue*$desconto+$taxa0*1 , 2 , "," , ".") .'</td> </tr>'; $parcela = $valor - (($desconto/100)*$valor); $table .= '<tr height="1"> <td></td> <td></td> <td></td> </tr>'; $table .= '<tr> <td class="res2" bgcolor="#FFC6C6"><b>Boleto Bancário</b></td> <td class="res2" bgcolor="#FF9999" ><b>R$ '. number_format($totalValue+$taxa1+$taxaboleto , 2 , "," , ".") .'</b></td> <td class="res2" bgcolor="#FF9999"><b>R$ '. number_format($totalValue+$taxa1+$taxaboleto*1 , 2 , "," , ".") .'</b></td> </tr>'; $table .= '<tr height="5"> <td></td> <td></td> <td></td> </tr>'; $table .= ' <tr height="5"> <td colspan="3" align="center" class="descricao"> <div id="CollapsiblePanel2" class="CollapsiblePanel"> <div class="CollapsiblePanelTab" tabindex="0"> <span class="descricao">Pagamento parcelado</span> </div> <div class="CollapsiblePanelContent">'; $table .= '<table width="100%" cellpadding="0" cellspacing="0" class="tbdescricao">'; $table .= '<tr height="5"> <td class="res1" bgcolor="#CCCCCC">Quantidade de<br />parcelas</td> <td class="res1" bgcolor="#999999">Valor da<br />Parcela</td> <td class="res1" bgcolor="#999999">Total<br />Parcelado</td> </tr> <tr> <td class="prazo1"><b><font color="FF0000">1x Sem juros</font></b></td> <td class="prazo2"><b><font color="FF0000">R$ '. number_format($totalValue/1 , 2 , "," , ".") .'</font></b></td> <td class="prazo2"><b><font color="FF0000">R$ '. number_format($totalValue/2*2 , 2 , "," , ".") .'</font></b></td> </tr>'; for($i = 0; $i < $splits; $i++){ if($i>$parcelaqtminimacc - 1){break;} $i % 2 == 0 ? $class = "res1" : $class = "res2"; if($i=='0'){$parcela = $valor - (($desconto/100)*$valor); } if($i+1=='2'){$taxa = 0.5200980;} if($i+1=='3'){$taxa = 0.3536320;} if($i+1=='4'){$taxa = 0.2705019;} if($i+1=='5'){$taxa = 0.2207079;} if($i+1=='6'){$taxa = 0.1875834;} if($i+1=='7'){$taxa = 0.1639854;} if($i+1=='8'){$taxa = 0.1463426;} if($i+1=='9'){$taxa = 0.1326709;} if($i+1=='10'){$taxa = 0.1217800;} if($i+1=='11'){$taxa = 0.1129122;} if($i+1=='12'){$taxa = 0.1055625;} if($i+1=='13'){$taxa = 0.0993815;} if($i+1=='14'){$taxa = 0.0941192;} if($i+1=='15'){$taxa = 0.0895927;} if($i+1=='16'){$taxa = 0.0856646;} if($i+1=='17'){$taxa = 0.0822300;} if($i+1=='18'){$taxa = 0.0792071;} if($i+1=='19'){$taxa = 0.0765316;} if($i+1=='20'){$taxa = 0.0741518;} if($i+1=='21'){$taxa = 0.0720261;} if($i+1=='22'){$taxa = 0.0701204;} if($i+1=='23'){$taxa = 0.0684064;} if($i+1=='24'){$taxa = 0.0668607;} if($i == $minSemJuroscc){ $table .= '<tr> <td class="prazo1">'. ($i+1) . 'x com juros*</td> <td class="prazo2">R$ '. number_format($totalValue*$taxa , 2 , "," , ".") . '</font></b></td> <td class="prazo2">R$ '. number_format($totalValue*$taxa*($i+1), 2 , "," , ".").'</td> </tr>'; }else{ if (($totalValue*$taxa) > $minvalor){ $valor = ( $totalValue / ($i+1) ); $table .= '<tr> <td class="prazo1"> '. ($i+1) . 'x com juros*</td> <td class="prazo2">R$ '. number_format($totalValue*$taxa , 2 , "," , ".") .'</td> <td class="prazo2">R$ '. number_format($totalValue*$taxa*($i+1) , 2 , "," , ".") .'</td> </tr>'; } } } $table .= "</table></div></div></td></tr>"; $table .= '<table width="' .$tablewidth. '" style="border: 0px dotted #ff0000;" cellpadding="0" cellspacing="0"><tr> <td class="res4" align="left">*Parcelado em 2 vezes ou mais, juros de 1.99% ao mês<br /><font color="#FF0000"><b> Parcelado em até 10X nos cartões Visa e Diners</b></font><br /><b> Parcelado em até 12X nos cartões Mastercard e HiperCard</b><br /><font color="#FF0000"><b> Parcelado em até 15X no cartão American Express</font></b><br /> Parcelado em até 24X no cartão Aura </tr> </td> </table> <script type="text/javascript"> <!-- var CollapsiblePanel2 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel2", {contentIsOpen:false}); //--> </script>'; return $table; } ?>Duvidas me retorne.Atenciosamente.Henrique Flausino Citar Link para o comentário Compartilhar em outros sites More sharing options...
Pergunta
Henrique Flausino
Boa tarde.
Caros.
Estou utilizando o sistema em php para mostrar informação sobre pagamento.
Preciso fazer com que a forma de pagamento à prazo só apareça quando o cliente clicar em pagamento parcelado.
Segue abaixo código.
Arquivo product_info.php
Arquivo pag_digital.phpAgradeço desde já pela atenção.
Henrique Flausino
Link para o comentário
Compartilhar em outros sites
3 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.