Support » Plugin: WP eCommerce » Translate "price" in frontend

Viewing 15 replies - 1 through 15 (of 15 total)
  • Hey…

    Go to:

    wp-content/plugins/wp-e-commerce/wpsc-theme/wpsc-products_page.php

    Go to (in unchanged file), line 161.

    From here until around ~185, you’ll see a number of display functions, one like:

    <?php _e(‘Price’, ‘wpsc’); ?>

    I guess you need to change that into Danish, same for the other ones like that.

    Hope that helps.

    Thread Starter Ligefrem

    (@ligefrem)

    That was my first guess also, but my wpsc_products_page.php doesnøt have that.

    It looks like this:

    Thread Starter Ligefrem

    (@ligefrem)

    That was my first guess also, but my wpsc_products_page.php doesnøt have that.

    It looks like this:

    <?php
    global $wp_query;
    $image_width = get_option('product_image_width');
    /*
     * Most functions called in this page can be found in the wpsc_query.php file
     */
    ?>
    <div id="default_products_page_container" class="wrap wpsc_container">
    
    <?php wpsc_output_breadcrumbs(); ?>
    
    	<?php do_action('wpsc_top_of_products_page'); // Plugin hook for adding things to the top of the products page, like the live search ?>
    	<?php if(wpsc_display_categories()): ?>
    	  <?php if(wpsc_category_grid_view()) :?>
    			<div class="wpsc_categories wpsc_category_grid group">
    				<?php wpsc_start_category_query(array('category_group'=> get_option('wpsc_default_category'), 'show_thumbnails'=> 1)); ?>
    					<a>" class="wpsc_category_grid_item  <?php wpsc_print_category_classes_section(); ?>" title="<?php wpsc_print_category_name(); ?>">
    						<?php wpsc_print_category_image(); ?>
    					</a>
    					<?php wpsc_print_subcategory("", ""); ?>
    				<?php wpsc_end_category_query(); ?>
    
    			</div><!--close wpsc_categories-->
    	  <?php else:?>
    			<ul class="wpsc_categories">
    
    				<?php wpsc_start_category_query(array('category_group'=>get_option('wpsc_default_category'), 'show_thumbnails'=> get_option('show_category_thumbnails'))); ?>
    
    <li>
    							<?php wpsc_print_category_image(); ?>
    
    							<a>" class="wpsc_category_link <?php wpsc_print_category_classes_section(); ?>" title="<?php wpsc_print_category_name(); ?>"><?php wpsc_print_category_name(); ?></a>
    							<?php if(wpsc_show_category_description()) :?>
    								<?php wpsc_print_category_description("<div class='wpsc_subcategory'>", "</div>"); ?>
    							<?php endif;?>
    
    							<?php wpsc_print_subcategory("
    <ul>", "</ul>
    "); ?>
    						</li>
    				<?php wpsc_end_category_query(); ?>
    
    		<?php endif; ?>
    	<?php endif; ?>
    <?php // */ ?>
    
    	<?php if(wpsc_display_products()): ?>
    
    		<?php if(wpsc_is_in_category()) : ?>
    			<div class="wpsc_category_details">
    				<?php if(wpsc_show_category_thumbnails()) : ?>
    					<img src="<?php echo wpsc_category_image(); ?>" alt="<?php echo wpsc_category_name(); ?>" />
    				<?php endif; ?>
    
    				<?php if(wpsc_show_category_description() &&  wpsc_category_description()) : ?>
    					<?php echo wpsc_category_description(); ?>
    				<?php endif; ?>
    			</div><!--close wpsc_category_details-->
    		<?php endif; ?>
    		<?php if(wpsc_has_pages_top()) : ?>
    			<div class="wpsc_page_numbers_top">
    				<?php wpsc_pagination(); ?>
    			</div><!--close wpsc_page_numbers_top-->
    		<?php endif; ?>
    
    		<div class="wpsc_default_product_list">
    		<?php /** start the product loop here */?>
    		<?php while (wpsc_have_products()) :  wpsc_the_product(); ?>
    
    			<div class="default_product_display product_view_<?php echo wpsc_the_product_id(); ?> <?php echo wpsc_category_class(); ?> group">
    				<h2 class="prodtitle entry-title">
    							<?php if(get_option('hide_name_link') == 1) : ?>
    								<?php echo wpsc_the_product_title(); ?>
    							<?php else: ?>
    								<a>"><?php echo wpsc_the_product_title(); ?></a>
    							<?php endif; ?>
    						</h2>
    				<?php if(wpsc_show_thumbnails()) :?>
    					<div class="imagecol" style="width:<?php echo $image_width; ?>;" id="imagecol_<?php echo wpsc_the_product_id(); ?>">
    						<?php if(wpsc_the_product_thumbnail()) :
    						?>
    							<a>" class="<?php echo wpsc_the_product_image_link_classes(); ?>" href="<?php echo esc_url( wpsc_the_product_image() ); ?>">
    								<img class="product_image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="<?php echo wpsc_the_product_title(); ?>" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo wpsc_the_product_thumbnail(); ?>"/>
    
    							</a>
    						<?php else: ?>
    								<a>">
    								<img class="no-image" id="product_image_<?php echo wpsc_the_product_id(); ?>" alt="<?php esc_attr_e( 'No Image', 'wpsc' ); ?>" title="<?php echo wpsc_the_product_title(); ?>" src="<?php echo WPSC_CORE_THEME_URL; ?>wpsc-images/noimage.png" width="<?php echo get_option('product_image_width'); ?>" height="<?php echo get_option('product_image_height'); ?>" />
    								</a>
    						<?php endif; ?>
    						<?php
    						if(gold_cart_display_gallery()) :
    							echo gold_shpcrt_display_gallery(wpsc_the_product_id(), true);
    						endif;
    						?>
    					</div><!--close imagecol-->
    				<?php endif; ?>
    					<div class="productcol" style="margin-left:<?php echo $image_width + 20; ?>px;" >
    
    						<?php
    							do_action('wpsc_product_before_description', wpsc_the_product_id(), $wp_query->post);
    							do_action('wpsc_product_addons', wpsc_the_product_id());
    						?>
    
    						<div class="wpsc_description">
    							<?php echo wpsc_the_product_description(); ?>
                            </div><!--close wpsc_description-->
    
    						<?php if(wpsc_the_product_additional_description()) : ?>
    						<div class="additional_description_container">
    								<img class="additional_description_button"  src="<?php echo WPSC_CORE_THEME_URL; ?>wpsc-images/icon_window_expand.gif" alt="<?php esc_html_e( 'Additional Description', 'wpsc' ); ?>" /><a>" class="additional_description_link"><?php esc_html_e('More Details', 'wpsc'); ?>
    							</a>
    							<div class="additional_description">
    								<p><?php echo wpsc_the_product_additional_description(); ?></p>
    							</div><!--close additional_description-->
    						</div><!--close additional_description_container-->
    						<?php endif; ?>
    
    						<?php if(wpsc_product_external_link(wpsc_the_product_id()) != '') : ?>
    							<?php $action =  wpsc_product_external_link(wpsc_the_product_id()); ?>
    						<?php else: ?>
    						<?php $action = wpsc_this_page_url(); ?>
    						<?php endif; ?>
    						<form class="product_form"  enctype="multipart/form-data" action="<?php echo esc_url( $action ); ?>" method="post" name="product_<?php echo wpsc_the_product_id(); ?>" id="product_<?php echo wpsc_the_product_id(); ?>" >
    						<?php do_action ( 'wpsc_product_form_fields_begin' ); ?>
    						<?php /** the variation group HTML and loop */?>
                            <?php if (wpsc_have_variation_groups()) { ?>
                            <fieldset><legend><?php _e('Product Options', 'wpsc'); ?></legend>
    						<div class="wpsc_variation_forms">
                            	<table>
    							<?php while (wpsc_have_variation_groups()) : wpsc_the_variation_group(); ?>
    								<tr><td class="col1"><label for="<?php echo wpsc_vargrp_form_id(); ?>"><?php echo wpsc_the_vargrp_name(); ?>:</label></td>
    								<?php /** the variation HTML and loop */?>
    								<td class="col2"><select class="wpsc_select_variation" name="variation[<?php echo wpsc_vargrp_id(); ?>]" id="<?php echo wpsc_vargrp_form_id(); ?>">
    								<?php while (wpsc_have_variations()) : wpsc_the_variation(); ?>
    									<option value="<?php echo wpsc_the_variation_id(); ?>" <?php echo wpsc_the_variation_out_of_stock(); ?>><?php echo wpsc_the_variation_name(); ?></option>
    								<?php endwhile; ?>
    								</select></td></tr>
    							<?php endwhile; ?>
                                </table>
    						</div><!--close wpsc_variation_forms-->
                            </fieldset>
    						<?php } ?>
    						<?php /** the variation group HTML and loop ends here */?>
    
    							<!-- THIS IS THE QUANTITY OPTION MUST BE ENABLED FROM ADMIN SETTINGS -->
    							<?php if(wpsc_has_multi_adding()): ?>
                                	<fieldset><legend><?php _e('Quantity', 'wpsc'); ?></legend>
    								<div class="wpsc_quantity_update">
                                    <?php /*<label for="wpsc_quantity_update_<?php echo wpsc_the_product_id(); ?>"><?php _e('Quantity', 'wpsc'); ?>:</label>*/ ?>
    								<input type="text" id="wpsc_quantity_update_<?php echo wpsc_the_product_id(); ?>" name="wpsc_quantity_update" size="2" value="1" />
    								<input type="hidden" name="key" value="<?php echo wpsc_the_cart_item_key(); ?>"/>
    								<input type="hidden" name="wpsc_update_quantity" value="true" />
                                    </div><!--close wpsc_quantity_update-->
                                    </fieldset>
    							<?php endif ;?>
    
    							<div class="wpsc_product_price">
    								<?php if( wpsc_show_stock_availability() ): ?>
    									<?php if(wpsc_product_has_stock()) : ?>
    										<div id="stock_display_<?php echo wpsc_the_product_id(); ?>" class="in_stock"><?php _e('Product in stock', 'wpsc'); ?></div>
    									<?php else: ?>
    										<div id="stock_display_<?php echo wpsc_the_product_id(); ?>" class="out_of_stock"><?php _e('Product not in stock', 'wpsc'); ?></div>
    									<?php endif; ?>
    								<?php endif; ?>
    								<?php if(wpsc_product_is_donation()) : ?>
    									<label for="donation_price_<?php echo wpsc_the_product_id(); ?>"><?php _e('Donation', 'wpsc'); ?>: </label>
    									<input type="text" id="donation_price_<?php echo wpsc_the_product_id(); ?>" name="donation_price" value="<?php echo wpsc_calculate_price(wpsc_the_product_id()); ?>" size="6" />
    
    								<?php else : ?>
    									<?php wpsc_the_product_price_display(); ?>
    
    									<!-- multi currency code -->
    									<?php if(wpsc_product_has_multicurrency()) : ?>
    	                                	<?php echo wpsc_display_product_multicurrency(); ?>
                                        <?php endif; ?>
    
    									<?php if(wpsc_show_pnp()) : ?>
    										<p class="pricedisplay"><?php _e('Levering', 'wpsc'); ?>:<span class="pp_price"><?php echo wpsc_product_postage_and_packaging(); ?></span></p>
    									<?php endif; ?>
    								<?php endif; ?>
    							</div><!--close wpsc_product_price-->
    
    							<input type="hidden" value="add_to_cart" name="wpsc_ajax_action"/>
    							<input type="hidden" value="<?php echo wpsc_the_product_id(); ?>" name="product_id"/>
    
    							<!-- END OF QUANTITY OPTION -->
    							<?php if((get_option('hide_addtocart_button') == 0) &&  (get_option('addtocart_or_buynow') !='1')) : ?>
    								<?php if(wpsc_product_has_stock()) : ?>
    									<div class="wpsc_buy_button_container">
    										<div class="wpsc_loading_animation">
    											<img title="" alt="<?php esc_attr_e( 'Loading', 'wpsc' ); ?>" src="<?php echo wpsc_loading_animation_url(); ?>" />
    											<?php _e('Updating cart...', 'wpsc'); ?>
    										</div><!--close wpsc_loading_animation-->
    											<?php if(wpsc_product_external_link(wpsc_the_product_id()) != '') : ?>
    											<?php $action = wpsc_product_external_link( wpsc_the_product_id() ); ?>
    											<input class="wpsc_buy_button" type="submit" value="<?php echo wpsc_product_external_link_text( wpsc_the_product_id(), __( 'Buy Now', 'wpsc' ) ); ?>" onclick="return gotoexternallink('<?php echo esc_url( $action ); ?>', '<?php echo wpsc_product_external_link_target( wpsc_the_product_id() ); ?>')">
    											<?php else: ?>
    										<input type="submit" value="<?php _e('Add To Cart', 'wpsc'); ?>" name="Buy" class="wpsc_buy_button" id="product_<?php echo wpsc_the_product_id(); ?>_submit_button"/>
    											<?php endif; ?>
    									</div><!--close wpsc_buy_button_container-->
    								<?php endif ; ?>
    							<?php endif ; ?>
    							<div class="entry-utility wpsc_product_utility">
    								<?php edit_post_link( __( 'Edit', 'wpsc' ), '<span class="edit-link">', '</span>' ); ?>
    							</div>
    							<?php do_action ( 'wpsc_product_form_fields_end' ); ?>
    						</form><!--close product_form-->
    
    						<?php if((get_option('hide_addtocart_button') == 0) && (get_option('addtocart_or_buynow')=='1')) : ?>
    							<?php echo wpsc_buy_now_button(wpsc_the_product_id()); ?>
    						<?php endif ; ?>
    
    						<?php echo wpsc_product_rater(); ?>
    
    					<?php // */ ?>
    				</div><!--close productcol-->
    			<?php if(wpsc_product_on_special()) : ?><span class="sale"><?php _e('Sale', 'wpsc'); ?></span><?php endif; ?>
    		</div><!--close default_product_display-->
    
    		<?php endwhile; ?>
    		<?php /** end the product loop here */?>
    		</div>
    		<?php if(wpsc_product_count() == 0):?>
    			<h3><?php  _e('There are no products in this group.', 'wpsc'); ?></h3>
    		<?php endif ; ?>
    	    <?php do_action( 'wpsc_theme_footer' ); ?>
    
    		<?php if(wpsc_has_pages_bottom()) : ?>
    			<div class="wpsc_page_numbers_bottom">
    				<?php wpsc_pagination(); ?>
    			</div><!--close wpsc_page_numbers_bottom-->
    		<?php endif; ?>
    	<?php endif; ?>
    </div><!--close default_products_page_container-->

    What version of WPEC are you using?

    Thread Starter Ligefrem

    (@ligefrem)

    3.8.9

    Makes sense… okay round 2:

    Go to:

    wp-content/plugins/wp-e-commerce/wpsc-includes/product-template.php

    Now go to line: 1929

    ‘old_price_text’ => __( ‘Old Price: %s’, ‘wpsc’ ),
    ‘price_text’ => __( ‘Price: %s’, ‘wpsc’ ),
    ‘you_save_text’ => __( ‘You save: %s’, ‘wpsc’ ),

    There you go… Make sure you only change those 3, the others are outputting html so you wont want to change them.

    Thread Starter Ligefrem

    (@ligefrem)

    Thanks! Brilliant 🙂

    No Problem… may as well resolved this one then!

    Great! I need too…

    I have the same problem and when I’m going to line: 1929 and change the words to Hebrew I’m getting gibberish words looking like this: ����.
    Do you have any idea how can I solve this problem?
    Thanks for your support,
    Roy

    Roy, it’s known problem for us working with Hebrew language. Make all the changes AliasEll wrote, but don’t forget to use Notepad++ as your text editor. Windows Notepad just don’t understand Hebrew :).

    Anton

    I had the same problem.
    Editing product-template.php is the quick way.
    The problem is that most of the po-files are not yet updated for the latest version of WP e-Commerce.
    A better way would be to download the program Poedit, load the po-file for your language and then update it with the catalogfile wpsc.pot.
    Then you can edit any string, whether already translated or not, and save your po-file.

    How do you update a .po-file with PoEdit? I had the same problem translating in finnish, which is now solved, thanks to you! How about “Please select” string in product variation drop down box, same problem there…?

    Easy: start POedit, open your .po-file (wpsc-fi.po in your case) and then choose Catalog -> Update from pot-file and then load wpsc.pot.
    New lines will be at the top of the list in blue (untranslated) and yellow (provisionally translated).

    Just did that, works like a charm. 🙂 Thanks a lot!

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Translate "price" in frontend’ is closed to new replies.