Pereiti prie turinio

Reikėtų pagalbos (php)


Rekomenduojami pranešimai

Sveiki, reikėtų paredaguoti šią funciją, kad valiutos simbolį rodytų už produkto kainos, o ne prieš. Gal kas galit padėti?

 

{
				 echo '<s>'.$General->get_currency_symbol() . number_format($Product->get_product_price_only($post->ID),2) $General->get_currency_symbol().'</s> ';
				 echo '<b>'.$Product->get_product_price_sale($post->ID).'</b>';

			}else
			{
				if($General->is_storetype_catalog())
				 {
					if($Product->get_product_price_only($post->ID)>0)
					{
						echo $General->get_currency_symbol() . number_format($Product->get_product_price_only($post->ID),2);	
					}
				 }else
				 {
					echo $General->get_currency_symbol() . number_format($Product->get_product_price_only($post->ID),2);
				 }
			 }

Nuoroda į pranešimą
Dalintis kituose puslapiuose

else dalis galėtų atrodyti taip:

 

else
			{
				if($General->is_storetype_catalog())
				 {
					if($Product->get_product_price_only($post->ID)>0)
					{
						echo number_format($Product->get_product_price_only($post->ID),2) . $General->get_currency_symbol();	
					}
				 }else
				 {
					echo number_format($Product->get_product_price_only($post->ID),2) . $General->get_currency_symbol();
				 }
			 }

 

O pradžioj ten reikėtų pamatyti kontekstą, nes keistokai parašyta. Jei reikia tik sukeisti vietomis, tai galima būtų rašyti taip:

 

{
				 echo '<s>'. number_format($Product->get_product_price_only($post->ID),2) .'</s> ';
				 echo '<b>'.$Product->get_product_price_sale($post->ID). $General->get_currency_symbol()$General->get_currency_symbol() . '</b>';
}

 

arba taip:

{
				 echo '<s>'. number_format($Product->get_product_price_only($post->ID),2) .'</s> ';
				 echo '<b>'.$Product->get_product_price_sale($post->ID).'<s>'. $General->get_currency_symbol()$General->get_currency_symbol() .'</s> '. '</b>';
}

 

arba taip:

{
				 echo '<s>'. number_format($Product->get_product_price_only($post->ID),2) .'</s> ';
				 echo '<b>'.$Product->get_product_price_sale($post->ID). '</b><s>'. $General->get_currency_symbol()$General->get_currency_symbol() .'</s> ';
}

Nuoroda į pranešimą
Dalintis kituose puslapiuose

Na neveikia man.

Čia visas kodas failo.

 

<?php
/*
Template Name: Store Page
*/
?>
<?php get_header(); ?>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/library/js/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function(){

$("a.switch_thumb").toggle(function(){
  $(this).addClass("swap"); 
  $("ul.display").fadeOut("fast", function() {
	$(this).fadeIn("fast").removeClass("thumb_view");
	 });
  }, function () {
  $(this).removeClass("swap");
  $("ul.display").fadeOut("fast", function() {
	$(this).fadeIn("fast").addClass("thumb_view"); 
	});
}); 

});
</script>
<div id="page"  class="container_16 clearfix">
<div class="breadcrumb clearfix">
  	 <?php if ( get_option( 'ptthemes_breadcrumbs' )) { yoast_breadcrumb('',  ' » ' . $_GET['page']); } ?>
</div> <!-- breadcrumbs #end -->
<div id="content">	  
<h1 class="head"><?php _e('Store');?></h1>
<?php
$totalpost_count = 0;
$limit = 1000;
$blogCategoryIdStr = str_replace(',',',-',get_inc_categories("cat_exclude_"));
query_posts('showposts=' . $limit . '&cat='.$blogCategoryIdStr);
if(have_posts())
{
while(have_posts())
{
	 the_post();
	$totalpost_count++;
}
}
//echo $totalpost_count;
$limit = 16; // number of posts per page for store page

$posts_per_page_homepage = $limit;
global $paged;
$blogCategoryIdStr = str_replace(',',',-',get_inc_categories("cat_exclude_"));
query_posts('showposts=' . $limit . '&paged=' . $paged .'&cat='.$blogCategoryIdStr);
?>
<?php
if(have_posts())
{
?>
  <?php /*?><ul class="category_list ">
	<?php
	while(have_posts())
	{
		the_post();
		$data = get_post_meta( $post->ID, 'key', true );
		$product_price = $Product->get_product_price($post->ID);
		?>
		<li>

		<?php
		if($Product->get_product_price_sale($post->ID)>0)
		{
		?>
		<img src="<?php bloginfo('template_directory'); ?>/images/sale.png" alt="" class="sale_img" />
		<?php
		}else
		{
		?>
		<?php
		}
		?>

			  <a href="<?php the_permalink() ?>" class="product_thumb" > 



			   <img title="<?php echo the_title();?>" src="<?php echo bloginfo('template_url'); ?>/thumb.php?src=<?php echo $data[ 'productimage' ]; ?>&w=143&zc=1&q=80" alt=""  /></a>

				 <p><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title_attribute(); ?>">
		<?php
		  echo substr($post->post_title,0,18);
		if(strlen($post->post_title)>19)
		{
			echo "...";
		}
		?></a></p> 

		 </li>
	<?php
	}
	?>
  </ul><?php */?>
  <a href="#" class="switch_thumb swap"><?php _e('Switch Thumb');?></a>
  <ul style="display: block;" class="display thumb_view category_list">
	<?php
	while(have_posts())
	{
		the_post();
		$data = get_post_meta( $post->ID, 'key', true );
		$product_price = $Product->get_product_price($post->ID);
		?>
	<li>
	  <div class="content_block"> <a href="<?php the_permalink() ?>" class="product_thumb"><img src="<?php echo bloginfo('template_url'); ?>/thumb.php?src=<?php echo $data[ 'productimage' ]; ?>&w=145&zc=1&q=80" alt=""  /></a>
		<?php
		if($Product->get_product_price_sale($post->ID)>0)
		{
		?>
		<img src="<?php bloginfo('template_directory'); ?>/images/sale.png" alt="" class="sale_img" />
		<?php
		}else
		{
		?>
		<?php
		}
		?>
		<div class="content">
		  <h3><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title_attribute(); ?>">
			<?php the_title(); ?>
			</a></h3>
		  <p class="contentp"><?php echo bm_better_excerpt(200, ' ... '); ?></p>
		  <p class="sale_price" >
		   <?php
			if($Product->get_product_price_sale($post->ID)>0)
			{
				 echo '<s>'.$General->get_currency_symbol() . number_format($Product->get_product_price_only($post->ID),2).'</s> ';
				 echo '<b>'.$General->get_currency_symbol() . $Product->get_product_price_sale($post->ID).'</b>';

			}else
			{
				if($General->is_storetype_catalog())
				 {
					if($Product->get_product_price_only($post->ID)>0)
					{
						echo $General->get_currency_symbol() . number_format($Product->get_product_price_only($post->ID),2);	
					}
				 }else
				 {
					echo $General->get_currency_symbol() . number_format($Product->get_product_price_only($post->ID),2);
				 }
			 }
			 ?>
		  <?php /*?><?php echo $General->get_currency_symbol() . number_format($Product->get_product_price_only($post->ID),2); ?><?php */?> </p>
		  <div class="viewdetails"> <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>" class="b_viewdetails fl"><?php _e('View Details');?> »</a> </div>
		</div>
	  </div>
	  <!-- content block #end -->
	</li>
	<?php
	}
	?>
  </ul>
  <div class="clearfix"></div>
  <?php
}
?>

	<div class="pagination">
	<div class="Navi">
	  <?php if (function_exists('wp_pagenavi')) { ?>
	  <?php wp_pagenavi(); ?>
	  <?php } ?>
	</div>
  </div>
 <?php 
global $Cart,$General;
$itemsInCartCount = $Cart->cartCount();
$cartAmount = $Cart->getCartAmt();
?>
			</div> <!-- content #end -->
		 <?php get_sidebar(); ?>
 </div> <!-- page #end -->
<?php get_footer(); ?>
 <!-- sidebar #end -->

Redagavo Ignaz
Nuoroda į pranešimą
Dalintis kituose puslapiuose

echo

- funkcija, atspausdinanti ką nors į ekraną;

$General->get_currency_symbol()

- reikėtų galvoti, kad čia funkcija grąžinanti valiutos simbolį;

.

- eilučių sujungimo operatorius;

number_format($Product->get_product_price_only($post->ID),2)

- funkcija kažkaip suformatuojanti skaičių;

 

Tiesiog sukeisk, kur rasi vietomis

number_format($Product->get_product_price_only($post->ID),2)

su

$General->get_currency_symbol()

Redagavo labutukas
Nuoroda į pranešimą
Dalintis kituose puslapiuose

Prisijunkite prie diskusijos

Jūs galite rašyti dabar, o registruotis vėliau. Jeigu turite paskyrą, prisijunkite dabar, kad rašytumėte iš savo paskyros.

Svečias
Parašykite atsakymą...

×   Įdėta kaip raiškusis tekstas.   Atkurti formatavimą

  Only 75 emoji are allowed.

×   Nuorodos turinys įdėtas automatiškai.   Rodyti kaip įprastą nuorodą

×   Jūsų anksčiau įrašytas turinys buvo atkurtas.   Išvalyti redaktorių

×   You cannot paste images directly. Upload or insert images from URL.

Įkraunama...
  • Dabar naršo   0 narių

    Nei vienas registruotas narys šiuo metu nežiūri šio puslapio.

  • Prisijunk prie bendruomenės dabar!

    Uždarbis.lt nariai domisi verslo, IT ir asmeninio tobulėjimo temomis, kartu sprendžia problemas, dalinasi žiniomis ir idėjomis, sutinka būsimus verslo partnerius ir dalyvauja gyvuose susitikimuose.

    Užsiregistruok dabar ir galėsi:

    ✔️ Dalyvauti diskusijose;

    ✔️ Kurti naujas temas;

    ✔️ Rašyti atsakymus;

    ✔️ Vertinti kitų žmonių pranešimus;

    ✔️ Susisiekti su bet kuriuo nariu asmeniškai;

    ✔️ Naudotis tamsia dizaino versija;

    ir dar daugiau.

    Registracija trunka ~30 sek. ir yra visiškai nemokama.

  • Naujausios temos

  • Karštos temos

×
×
  • Pasirinkite naujai kuriamo turinio tipą...