fa_dy Posted November 29, 2012 Share Posted November 29, 2012 Hello guys, hope all of you're doing good. I have a website running an ecommerce theme powered by wordpress. Inside it, there's this product page which I've on which there are two tables (http://allwebutilities.com/finewatches/product/pen/). The first table consists of the following headings: Size, Price, Strap/Bracelet, Case & Back, Specifications and Shape. And the second table consists of the following headings: Size, Cap, Clip, Trim, Barrel, Refill. Now what I want to do is that if I've fed a certain value of 'Cap' in the backend, then only the first table should be echo'd out. For example, if I've entered the value of 'Cap' as 'No' in the backend, then only the first table is echo'd out. But if there's any other value of 'Cap' entered in the backend, then only the second table is echo'd out. I know this can be done using the If and Else statements but I just can't get it right. Please help me guys. Here's the code which is echoing out the products page. <?php get_header(); ?>[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3]<?php $aOptions = SofaSuppaStore::initOptions( false ); $entrycurrency = $aOptions[ 'entrycurrency' ]; $prod_use_related = $aOptions[ 'prod_use_related' ]; $prod_disable_comments = $aOptions[ 'prod_disable_comments' ]; $num_of_mb = $aOptions[ 'num_of_def_boxes' ]; $use_stock = $aOptions[ 'use_stock' ]; if( $num_of_mb <= 0 ) $num_of_mb = 1; ?>[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3]<!-- main content start --> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php // meta stuff $arr_price = array();[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3]$arr_sizes = array();[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3]$arr_stock = array();[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3]$arr_shipp = array();[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3]$arr_strap = array();[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3]$arr_case = array();[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3]$arr_spec = array();[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3]$arr_shape = array();[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3]$arr_sze = array(); $arr_cap = array();[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3]$arr_clip = array(); $arr_trim = array(); $arr_barr = array(); $arr_refi = array();[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3]$iter_meta = 0;[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3]// extract post meta[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3]while( $iter_meta < $num_of_mb ) {[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $single_price = 'sofa_' . $iter_meta . '_textarea_price';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $single_sizes = 'sofa_' . $iter_meta . '_textarea_size';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $single_stock = 'sofa_' . $iter_meta . '_textarea_stock';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $single_shipp = 'sofa_' . $iter_meta . '_textarea_shipp';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $single_strap = 'sofa_' . $iter_meta . '_textarea_strap';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $single_case = 'sofa_' . $iter_meta . '_textarea_case';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $single_spec = 'sofa_' . $iter_meta . '_textarea_spec';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $single_shape = 'sofa_' . $iter_meta . '_textarea_shape'; $single_sze = 'sofa_' . $iter_meta . '_textarea_sze';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $single_cap = 'sofa_' . $iter_meta . '_textarea_cap';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $single_clip = 'sofa_' . $iter_meta . '_textarea_clip';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $single_trim = 'sofa_' . $iter_meta . '_textarea_trim';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $single_barr = 'sofa_' . $iter_meta . '_textarea_barr';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $single_refi = 'sofa_' . $iter_meta . '_textarea_refi'; // populate array $single_id = get_the_ID(); // just to speed it up if( get_post_meta( $single_id, $single_price, true ) != '*' ) {[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] array_push( $arr_price, get_post_meta( $single_id, $single_price, true ) );[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] array_push( $arr_sizes, get_post_meta( $single_id, $single_sizes, true ) );[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] array_push( $arr_strap, get_post_meta( $single_id, $single_strap, true ) );[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] array_push( $arr_case, get_post_meta( $single_id, $single_case, true ) );[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] array_push( $arr_spec, get_post_meta( $single_id, $single_spec, true ) );[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] array_push( $arr_shape, get_post_meta( $single_id, $single_shape, true ) ); array_push( $arr_sze, get_post_meta( $single_id, $single_sze, true ) ); array_push( $arr_cap, get_post_meta( $single_id, $single_cap, true ) );[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] array_push( $arr_clip, get_post_meta( $single_id, $single_clip, true ) );[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] array_push( $arr_trim, get_post_meta( $single_id, $single_trim, trim ) );[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] array_push( $arr_barr, get_post_meta( $single_id, $single_barr, true ) ); array_push( $arr_refi, get_post_meta( $single_id, $single_refi, true ) );[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] if( $use_stock == 'yes' ) { $stock_post_meta_value = get_post_meta( $single_id, $single_stock, true ); if( $stock_post_meta_value == '*' ) array_push( $arr_stock, 0 ); else array_push( $arr_stock, $stock_post_meta_value ); } if( get_post_meta( $single_id, $single_shipp, true ) != '*' ) array_push( $arr_shipp, get_post_meta( $single_id, $single_shipp, true ) ); } $iter_meta ++; } // content $content = get_the_content(); $content = apply_filters( 'the_content', $content ); $content = str_replace( ']]>', ']]>', $content ); $content = preg_replace( '|(class=[\'"]wp-caption.*?[\'"]).*?(style=[\'"](.*?)[\'"]).*?|i', '$1', $content ); // remove captions from extracted images $p_page = __( "Previous page", "sofa_suppastore" ); $n_page = __( "Next page", "sofa_suppastore" ); wp_link_pages( array( 'before' => '<div id="pagination" class="wp-pagenavi grid_8 alpha omega"><span class="nava">', 'next_or_number' => 'next', 'previouspagelink' => $p_page, 'nextpagelink' => $n_page, 'after' => '</span></div>' ) ); ?> <!-- content start -->[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] <div id="featured" class="grid_8"> <!-- title start --> <h1 class="grid_8 alpha"><?php the_title(); ?></h1> <!-- title end --> <!-- images set start --> <div id="prodimageset" class="castshadow grid_4 alpha"> <?php // any featured image? if( has_post_thumbnail() && get_the_post_thumbnail( $single_id, 'featured' ) != '' ) { $featured_image_id = get_post_thumbnail_id(); $large_image_url = wp_get_attachment_image_src( $featured_image_id, 'large' ); echo '<div class="grid_4 alpha omega">'; echo '<a href="' . $large_image_url[ 0 ] . '" title="' . the_title_attribute( 'echo=0' ) . '">'; the_post_thumbnail( 'featured' ); echo '</a>'; echo '</div>'; } ?> </div> <!-- images set end --> <!-- product selection start -->[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] <div id="proddetails" class="grid_4 omega"> <h1 id="prodprice"><?php echo $entrycurrency . ' ' . number_format( $arr_price[ 0 ], 2, '.', '' ); ?></h1> <table id="tblmeta" width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <th scope="col" class="center"><?php _e( "Size", "sofa_suppastore" ); ?></th> <th scope="col" class="<?php if( empty( $arr_shipp ) && $use_stock == 'no' ) echo 'center'; else echo 'center'; ?>"><?php echo __( "Price", "sofa_suppastore" ) . ' ' . '(' . $entrycurrency . ')'; ?></th> <?php if( !empty( $arr_shipp ) ) { ?><th scope="col" class="<?php if( $use_stock == 'no' ) echo 'center'; else echo 'center'; ?>"><?php echo __( "Movement", "sofa_suppastore" ); ?></th><?php } ?> <?php if( $use_stock == 'yes' ) { ?><th scope="col" class="textright"><?php _e( "Stock", "sofa_suppastore" ); ?></th><?php } ?> <th scope="col" class="center"><?php _e( "Strap/<br />Bracelet", "sofa_suppastore" ); ?></th> </tr>[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] <?php // loop through meta $iter_chck = 0; $iter_loop = 0; $iter_leng = count( $arr_price ); while( $iter_loop < $iter_leng ) { if( $use_stock == 'yes' ) { if( $arr_stock[ $iter_loop ] != '*' && $arr_stock[ $iter_loop ] > 0 ) { // don't list products that are out of stock! $iter_chck ++; echo '<tr id="infoline_' . $iter_loop . '" class="proddetailstr">'; echo '<td title="size" class="center">' . $arr_sizes[ $iter_loop ] . '</td>'; echo '<td title="price" class="center">' . number_format( $arr_price[ $iter_loop ], 2, '.', '' ) . '</td>'; if( !empty( $arr_shipp ) ) echo '<td title="shipp" class="center">' . number_format( $arr_shipp[ $iter_loop ], 2, '.', '' ) . '</td>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $true_stock_value = 0; if( $arr_stock[ $iter_loop ] != '*' ) $true_stock_value = $arr_stock[ $iter_loop ]; echo '<td title="stock" class="textright">' . $true_stock_value . '</td>'; echo '<td title="strap" class="center">' . $arr_strap[ $iter_loop ] . '</td>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '</tr>'; } } elseif( $use_stock == 'no' ) { $iter_chck ++; echo '<tr id="infoline_' . $iter_loop . '" class="proddetailstr">'; echo '<td title="size" class="optionstill textleft">' . $arr_sizes[ $iter_loop ] . '</td>'; if( !empty( $arr_shipp ) ) echo '<td title="price" class="center">' . number_format( $arr_price[ $iter_loop ], 2, '.', '' ) . '</td>'; else echo '<td title="price" class="center">' . number_format( $arr_price[ $iter_loop ], 2, '.', '' ) . '</td>'; if( !empty( $arr_shipp ) ) echo '<td title="shipp" class="center">' . $arr_shipp[ $iter_loop ] . '</td>'; echo '<td title="strap" class="center">' . $arr_strap[ $iter_loop ] . '</td>'; echo '</tr>'; } $iter_loop ++; } if( $iter_chck == 0 ) { echo '<tr>'; echo '<td colspan="4" class="textleft">' . __( "Product not available!", "sofa_suppastore" ) . '</td>'; echo '</tr>'; } ?> </table>[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] <table id="tblmeta" width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <th scope="col" class="center"><?php _e( "Case & Back", "sofa_suppastore" ); ?></th> <th scope="col" class="center"><?php _e( "Specifications", "sofa_suppastore" ); ?></th> <th scope="col" class="center"><?php _e( "Shape", "sofa_suppastore" ); ?></th> </tr> <?php // loop through meta $iter_chck = 0; $iter_loop = 0; $iter_leng = count( $arr_price ); while( $iter_loop < $iter_leng ) { if( $use_stock == 'yes' ) { if( $arr_stock[ $iter_loop ] != '*' && $arr_stock[ $iter_loop ] > 0 ) { // don't list products that are out of stock! $iter_chck ++; echo '<tr id="infoline_' . $iter_loop . '" class="proddetailstr">'; echo '<td title="case" class="center">' . $arr_case[ $iter_loop ] . '</td>'; echo '<td title="spec" class="center">' . $arr_spec[ $iter_loop ] . '</td>'; echo '<td title="shape" class="center">' . $arr_shape[ $iter_loop ] . '</td>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '</tr>'; } } elseif( $use_stock == 'no' ) { $iter_chck ++; echo '<tr id="infoline_' . $iter_loop . '" class="proddetailstr">'; echo '<td title="case" class="center">' . $arr_case[ $iter_loop ] . '</td>'; echo '<td title="spec" class="center">' . $arr_spec[ $iter_loop ] . '</td>'; echo '<td title="shape" class="center">' . $arr_shape[ $iter_loop ] . '</td>'; echo '</tr>'; } $iter_loop ++; } if( $iter_chck == 0 ) { echo '<tr>'; echo '<td colspan="4" class="textleft">' . __( "Product not available!", "sofa_suppastore" ) . '</td>'; echo '</tr>'; } ?> </table> <table id="tblmeta" width="100%" border="0" cellspacing="0" cellpadding="0">[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] <tr>[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] <th scope="col" class="center"><?php _e( "Size", "sofa_suppastore" ); ?></th>[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] <th scope="col" class="center"><?php _e( "Cap", "sofa_suppastore" ); ?></th>[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] <th scope="col" class="center"><?php _e( "Clip", "sofa_suppastore" ); ?></th>[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] </tr> [/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] <?php[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] // loop through meta[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $iter_chck = 0;[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $iter_loop = 0;[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $iter_leng = count( $arr_price );[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] while( $iter_loop < $iter_leng ) {[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] if( $use_stock == 'yes' ) {[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] if( $arr_stock[ $iter_loop ] != '*' && $arr_stock[ $iter_loop ] > 0 ) { // don't list products that are out of stock![/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $iter_chck ++;[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '<tr id="infoline_' . $iter_loop . '" class="proddetailstr">';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '<td title="sze" class="center">' . $arr_sze[ $iter_loop ] . '</td>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '<td title="cap" class="center">' . $arr_cap[ $iter_loop ] . '</td>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '<td title="clip" class="center">' . $arr_clip[ $iter_loop ] . '</td>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '</tr>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] }[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] } elseif( $use_stock == 'no' ) {[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $iter_chck ++;[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '<tr id="infoline_' . $iter_loop . '" class="proddetailstr">';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '<td title="sze" class="center">' . $arr_sze[ $iter_loop ] . '</td>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '<td title="cap" class="center">' . $arr_cap[ $iter_loop ] . '</td>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '<td title="clip" class="center">' . $arr_clip[ $iter_loop ] . '</td>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '</tr>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] }[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $iter_loop ++;[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] }[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] if( $iter_chck == 0 ) {[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '<tr>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '<td colspan="4" class="textleft">' . __( "Product not available!", "sofa_suppastore" ) . '</td>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '</tr>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] }[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] ?>[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] </table> <table id="tblmeta" width="100%" border="0" cellspacing="0" cellpadding="0">[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] <tr>[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] <th scope="col" class="center"><?php _e( "Trim", "sofa_suppastore" ); ?></th>[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] <th scope="col" class="center"><?php _e( "Barrel", "sofa_suppastore" ); ?></th>[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] <th scope="col" class="center"><?php _e( "Refill", "sofa_suppastore" ); ?></th>[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] </tr>[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] <?php[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] // loop through meta[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $iter_chck = 0;[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $iter_loop = 0;[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $iter_leng = count( $arr_price );[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] while( $iter_loop < $iter_leng ) {[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] if( $use_stock == 'yes' ) {[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] if( $arr_stock[ $iter_loop ] != '*' && $arr_stock[ $iter_loop ] > 0 ) { // don't list products that are out of stock![/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $iter_chck ++;[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '<tr id="infoline_' . $iter_loop . '" class="proddetailstr">';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '<td title="trim" class="center">' . $arr_trim[ $iter_loop ] . '</td>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '<td title="barr" class="center">' . $arr_barr[ $iter_loop ] . '</td>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '<td title="refi" class="center">' . $arr_refi[ $iter_loop ] . '</td>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '</tr>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] }[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] } elseif( $use_stock == 'no' ) {[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $iter_chck ++;[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '<tr id="infoline_' . $iter_loop . '" class="proddetailstr">';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '<td title="trim" class="center">' . $arr_trim[ $iter_loop ] . '</td>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '<td title="barr" class="center">' . $arr_barr[ $iter_loop ] . '</td>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '<td title="refi" class="center">' . $arr_refi[ $iter_loop ] . '</td>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '</tr>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] }[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] $iter_loop ++;[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] }[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] if( $iter_chck == 0 ) {[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '<tr>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '<td colspan="4" class="textleft">' . __( "Product not available!", "sofa_suppastore" ) . '</td>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] echo '</tr>';[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] }[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] ?>[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] </table> <?php if( $iter_chck > 0 ) { ?>[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3]<?php edit_post_link( $link, $before, $after, $id ); ?> [/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] <p>No Hidden Charges<br>Free Delivery Across Pakistan<br>Payment At The Time Of Delivery</p>[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] <div class="grid_4 alpha omega"> <div class="left"><button class="close">Close Form</button></div>[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] <div class="right"><button class="btn2">Order Now!</button></div> </div>[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3]<br><br><br><br><div id="div1"><form name="contactform" method="post" action="http://allwebutilities.com/finewatches/send_form_email.php"> <table width="450px"> <tr> <td valign="top"> <label for="first_name">First Name *</label> </td> <td valign="top"> <input type="text" required name="first_name" maxlength="50" size="23"> </td> </tr> <tr> <td valign="top""> <br><label for="last_name">Last Name *</label> </td> <td valign="top"> <br><input type="text" required name="last_name" maxlength="50" size="23"> </td> </tr> <tr> <td valign="top"> <br><label for="email">Email Address*</label> </td> <td valign="top"> <br><input type="email" required name="email" maxlength="800" size="23"> </td> </tr> <tr> <td valign="top"> <br><label for="telephone">Cell Number*</label> </td> <td valign="top"> <br><input type="text" required name="telephone" maxlength="300" size="23"> </td> </tr> <tr> <td valign="top"> <br><label for="age">Age*</label> </td> <td valign="top"> <br><input type="text" required name="age" maxlength="30" size="3"> </td> </tr> <tr> <td valign="top"> <br><label for="quantity">Quantity*</label> </td> <td valign="top"> <br><input type="text" required name="quantity" maxlength="30" size="3"> </td> </tr> <tr> <td valign="top"> <br><label for="address">Address*</label> </td> <td valign="top"> <br><input type="text" required name="address" maxlength="1000" size="23"> </td> </tr> <tr> <td valign="top"> <br><label for="city">City*</label> </td> <td valign="top"> <br><input name="city" required type="text" id="mobile" size="23" /> </td> </tr> <tr> <td valign="top"> <br><label for="comments">Comments/<br>Instructions</label> </td> <td valign="top"> <br><textarea name="comments" maxlength="1000" cols="19" rows="6"></textarea> </td> </tr> <tr> <td colspan="2" style="text-align:center"> <br><button type="submit">Submit</button> <button type="reset">Reset</button> </td> </tr> </table> <div class="no-display"> <input type="hidden" name="product_namee" value="<?php the_title(); ?>" /> <input type="hidden" name="product_nameee" value="<?php the_permalink(); ?>" /> </div> </form> </div> <?php } ?> <input type="hidden" name="itemselmeta" id="itemselmeta" value="" /> <input type="hidden" name="itemid" id="itemid" value="<?php the_ID(); ?>" /> <input type="hidden" name="dothis" id="dothis" value="addnew" /> <input type="hidden" name="itemsize" id="itemsize" value="" /> <input type="hidden" name="itemprice" id="itemprice" value="" /> <input type="hidden" name="itemstock" id="itemstock" value="" /> <input type="hidden" name="itemshipp" id="itemshipp" value="" /> <?php wp_nonce_field( 'chck_ref_cc', 'sofa_suppastore_cc' ); ?>[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] <!-- product selection end --> </div> <!-- product description start --> <div class="grid_8 alpha omega"> <?php // get all other images attached to this product... $html_tab_images = ''; $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => NULL, 'post_parent' => $single_id, 'exclude' => get_post_thumbnail_id() ); $attachments = get_posts( $args ); if( $attachments ) { $i = 1; $html_tab_images .= '<div id="pimages" class="tab-content">'; foreach( $attachments as $attachment ) { if( $i % 4 == 0 ) $switch_class = ' alpha omega'; elseif( ( $i - 1 ) % 4 == 0 ) $switch_class = ''; else $switch_class = ''; $large_image_url = wp_get_attachment_image_src( $attachment->ID, 'large' ); $html_tab_images .= '<span style="width: 130px;" class="prodimgwrap alignleft' . $switch_class . '"><a href="' . $large_image_url[ 0 ] . '" title="' . the_title_attribute( 'echo=0' ) . '">'; $html_tab_images .= wp_get_attachment_image( $attachment->ID, 'thumbnail' ); $html_tab_images .= '</a><span class="imgshadow"><span class="shadowleft"> </span><span class="shadowright"> </span></span></span>'; $i ++; } echo '</div>'; } ?> <span class="prodtab"><a class="tablink tabactive" href="javascript:;" rel="pdetails"><?php _e( "Product Details", "sofa_suppastore" ); ?></a></span> <?php if( $attachments ) { ?><span class="prodtab"><a class="tablink tabnormal" href="javascript:;" rel="pimages"><?php _e( "More Images", "sofa_suppastore" ); ?></a></span><?php } ?> <div id="pdetails" class="tab-content defaulttab"> <?php // remove images from content $content = preg_replace( '|<a.*?href=[\'"](.*?)[\'"].*?>.*?<img.*?src=[\'"](.*?)[\'"].*?alt=[\'"](.*?)[\'"].*?><.*?a>|i', '', $content ); echo $content; ?> </div> <?php echo $html_tab_images; ?> </div> <!-- product description end --> <!-- content end --> <!-- related products scroller start --> <?php if( $prod_use_related == 'yes' ) { // handle related products... $backup = $post; // backup the current object $tags = wp_get_post_tags( $single_id ); $tagIDs = array(); if( $tags ) { $tagcount = count( $tags ); for( $i = 0; $i < $tagcount; $i++ ) { $tagIDs[ $i ] = $tags[ $i ]->term_id; } $args = array( 'tag__in' => $tagIDs, 'post__not_in' => array( $single_id ), 'showposts' => -1, 'post_type' => 'product' ); $my_query = new WP_Query( $args ); // how many related posts? $my_query->post_count; if( $my_query->have_posts() ) : ?> <div class="clear"> </div> <div id="relatedproducts" class="castshadow grid_8 alpha"> <div class="bordertop grid_8 alpha omega"> <!-- control button left start --> <div class="grid_2 alpha"> <?php if( $my_query->post_count > 4 ) { ?> <span class="addtocart prevPage"><a href="#l"><?php _e( "Previous", "sofa_suppastore" ); ?></a></span> <?php } else echo ' '; ?> </div> <!-- control button left end --> <!-- title start --> <div class="grid_4 center"> <h2 class="relatedtitle"><?php _e( "Related products", "sofa_suppastore" ); ?></h2> </div> <!-- title end --> <!-- control button right start --> <div class="grid_2 omega"> <?php if( $my_query->post_count > 4 ) { ?> <span class="addtocart nextPage"><a href="#r"><?php _e( "Next", "sofa_suppastore" ); ?></a></span> <?php } else echo ' '; ?> </div> <!-- control button right end --> </div> <div class="scrollable"> <ul class="images items"> <!-- wordpress sub-loop loop start --> <?php $count_items = 0; while( $my_query->have_posts() ) : $my_query->the_post(); // related post details $rel_product_meta_labeltype = get_post_meta( $post->ID, 'labeltype', true ); $rel_product_meta_labelvalue = get_post_meta( $post->ID, 'labelvalue', true ); $rel_product_meta_price = get_post_meta( $post->ID, 'sofa_0_textarea_price', true ); // extract image $rel_prod_image_link = ''; if( has_post_thumbnail( $post->ID ) ) { $default_attr = array( 'class' => "size-thumbnail clearfix alignleft", 'alt' => $post->post_title, 'title' => $post->post_title ); if( $rel_product_meta_labeltype != '' && $rel_product_meta_labelvalue != '' ) { $rel_prod_image_link .= ( '<a href="' . get_permalink( $post->ID ) . '" rel="' . $rel_product_meta_labeltype . '|' . $rel_product_meta_labelvalue . '">' ); } else $rel_prod_image_link .= ( '<a href="' . get_permalink( $post->ID ) . '">' ); $rel_prod_image_link .= get_the_post_thumbnail( $post->ID, 'thumbnail', $default_attr ); $rel_prod_image_link .= '</a>'; } ?> <li> <div class="grid_2 product alpha"> <?php echo $rel_prod_image_link; ?> <span class="prodtitle clearfix"> <?php echo $post->post_title; ?> </span> </div> </li> [/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] <?php endwhile; // backup query aka reset custom query posts loop $post = $backup; wp_reset_query(); ?> <!-- wordpress sub-loop loop end -->[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] </ul> </div> </div> <!-- related products scroller end --> <?php endif; } // end if tags } // end if use related ?> <?php endwhile; ?>[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] <script type="text/javascript">[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3]jQuery(document).ready(function(){ jQuery("#div1").hide(); jQuery(".close").hide(); jQuery(".close").click(function(){ jQuery("#div1").fadeOut() }); jQuery(".close").click(function(){ jQuery(".close").fadeOut() }); jQuery(".btn2").click(function(){ jQuery("#div1").fadeIn(); }); jQuery(".btn2").click(function(){ jQuery(".close").fadeIn(); }); } ); jQuery( document ).ready( function() { // tabs jQuery( '.prodtab a' ).click( function() { if( !jQuery( this ).is( '.tabactive' ) ) switch_tabs( jQuery( this ) ); } ); // related products - Scrollable <?php if( $prod_use_related == 'yes' ) { if( $tags ) { ?>jQuery( "div.scrollable" ).scrollable( { size: 4, speed: 300 } );<?php } } ?> // table tr hover jQuery( function() { jQuery( 'table .proddetailstr' ).hover( function() { jQuery( this ).addClass( 'hovered' ); jQuery( this ).css( 'cursor', 'default' ); }, function() { jQuery( this ).removeClass( 'hovered' ); } ) } ); // colorbox // jQuery( "a[rel='productslide']" ).colorbox( { transition: "fade" } ); // anything already written to fields (browser cache?) var written_meta = decodeURIComponent( jQuery( '#itemselmeta' ).val() ); var written_price = jQuery( '#itemprice' ).val(); if( written_meta != '' ) jQuery( written_meta + ' td:first-child' ).removeClass( 'optionstill' ).addClass( 'optionactiv' ); else { jQuery( '#infoline_0 td:first-child' ).removeClass( 'optionstill' ).addClass( 'optionactiv' ); // populate other crucial info with initial values jQuery( '#itemselmeta' ).val( '%23infoline_0' ); jQuery( '#itemsize' ).val( "<?php echo $arr_sizes[ 0 ]; ?>" ); jQuery( '#itemprice' ).val( "<?php echo $arr_price[ 0 ]; ?>" ); <?php if( $use_stock == 'yes' ) { ?>jQuery( '#itemstock' ).val( "<?php echo $arr_stock[ 0 ]; ?>" );<?php } ?> <?php if( !empty( $arr_shipp ) ) { ?>jQuery( '#itemshipp' ).val( "<?php echo $arr_shipp[ 0 ]; ?>" );<?php } ?> } if( written_price != '' ) jQuery( '#prodprice' ).html( "<?php echo $entrycurrency . ' '; ?>" + written_price ); // handle selections jQuery( '.proddetailstr' ).click( function( event ) { var this_id = '#' + jQuery( this ).attr( 'id' ); var options_length = jQuery( this_id + ' td' ).length; if( options_length > 0 ) { var ii = 0; while( ii < options_length ) { // faster than jQuery.each var cell_value = jQuery( this_id + ' td' ).eq( ii ).text(); var cell_title = jQuery( this_id + ' td' ).eq( ii ).attr( 'title' ); switch( cell_title ) { case 'size': jQuery( '#itemsize' ).val( encodeURIComponent( cell_value ) ); break; case 'price': jQuery( '#itemprice' ).val( encodeURIComponent( cell_value ) ); break; <?php if( $use_stock == 'yes' ) { ?> case 'stock': jQuery( '#itemstock' ).val( encodeURIComponent( cell_value ) ); break; <?php } ?> <?php if( !empty( $arr_shipp ) ) { ?> case 'shipp': jQuery( '#itemshipp' ).val( encodeURIComponent( cell_value ) ); break; <?php } ?> default: 0; } ii ++; } // remember selection if( jQuery( this ).attr( 'id' ).substring( 0, 8 ) == 'infoline' ) jQuery( '#itemselmeta' ).val( encodeURIComponent( this_id ) ); // remove all active selections var my_parent = '#' + jQuery( this_id ).parent().parent().attr( 'id' ); jQuery( my_parent + ' tr td:first-child' ).each( function() { jQuery( this ).removeClass( 'optionactiv' ).addClass( 'optionstill' ); } ); // switch class to selected jQuery( this_id + ' td:first-child' ).removeClass( 'optionstill' ).addClass( 'optionactiv' ); // update main price jQuery( '#prodprice' ).html( "<?php echo $entrycurrency . ' '; ?>" + jQuery( '#itemprice' ).val() ); } } ); } ); function switch_tabs( obj ) { jQuery( '.tab-content' ).slideUp( 'fast', function() { jQuery( '#' + obj.attr( "rel" ) ).slideDown( 'fast' ); } ); jQuery( '.prodtab a' ).removeClass( 'tabactive' ); obj.addClass( 'tabactive' ); } </script> <!-- comments --> <?php if( 'open' == $post->comment_status && $prod_disable_comments == 'no' ) comments_template(); ?> <!-- end comments --> </div> <?php else: ?> <!-- no content start -->[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3] <div id="featured" class="castshadow grid_8"> <div class="grid_8 alpha"> <h1><?php _e( "Nothing found!", "sofa_suppastore" ); ?></h1> <p><?php _e( "Sorry but no products found. Take your time, there's gonna be soon to see something listed here.", "sofa_suppastore" ); ?></p> </div> </div> <!-- no content end --> <?php endif; ?> <!-- main content end -->[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3]<!-- include sidebar start --> <?php get_template_part( 'sidebar_single_product' ); ?> <!-- include sidebar end -->[/size][/font][/color] [color=#000000][font=Tahoma, Verdana, Arial][size=3]<?php get_footer(); ?> I don't mind using Javascript for this either. I just need a solution. Thanking you all in advance. Quote Link to comment Share on other sites More sharing options...
Barand Posted November 30, 2012 Share Posted November 30, 2012 You really expect someone to search through that mess of tags and code for your problem? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.