| 1 |
<?php |
| 2 |
/** |
| 3 |
* Single item page template |
| 4 |
* |
| 5 |
* @package Welcart |
| 6 |
*/ |
| 7 |
|
| 8 |
usces_the_item(); |
| 9 |
|
| 10 |
$html = '<div id="itempage">'; |
| 11 |
$html .= '<form action="' . esc_url( USCES_CART_URL ) . '" method="post">'; |
| 12 |
|
| 13 |
$html .= '<div class="itemimg">'; |
| 14 |
$html .= '<a href="' . usces_the_itemImageURL( 0, 'return' ) . '"'; |
| 15 |
$html .= apply_filters( 'usces_itemimg_anchor_rel', '' ); |
| 16 |
$html .= '>'; |
| 17 |
$item_image = usces_the_itemImage( 0, 200, 250, $post, 'return' ); |
| 18 |
$html .= apply_filters( 'usces_filter_the_itemImage', $item_image, $post ); |
| 19 |
$html .= '</a>'; |
| 20 |
$html .= '</div>'; |
| 21 |
|
| 22 |
if ( 1 === usces_sku_num() ) { |
| 23 |
usces_have_skus(); |
| 24 |
|
| 25 |
$html .= '<h3>' . esc_html( usces_the_itemName( 'return' ) ) . ' (' . esc_html( usces_the_itemCode( 'return' ) ) . ') </h3>'; |
| 26 |
$html .= '<div class="exp clearfix">'; |
| 27 |
$html .= '<div class="field">'; |
| 28 |
if ( 0 < usces_the_itemCprice( 'return' ) ) { |
| 29 |
$usces_listprice = esc_html__( 'List price', 'usces' ) . usces_guid_tax( 'return' ); |
| 30 |
$html .= '<div class="field_name">' . apply_filters( 'usces_filter_listprice_label', $usces_listprice, esc_html__( 'List price', 'usces' ), usces_guid_tax( 'return' ) ) . '</div>'; |
| 31 |
$html .= '<div class="field_cprice">' . usces_the_itemCpriceCr( 'return' ) . '</div>'; |
| 32 |
} |
| 33 |
$usces_sellingprice = esc_html__( 'selling price', 'usces' ) . usces_guid_tax( 'return' ); |
| 34 |
$html .= '<div class="field_name">' . apply_filters( 'usces_filter_sellingprice_label', $usces_sellingprice, esc_html__( 'selling price', 'usces' ), usces_guid_tax( 'return' ) ) . '</div>'; |
| 35 |
$html .= '<div class="field_price">' . usces_the_itemPriceCr( 'return' ) . '</div>'; |
| 36 |
$html .= usces_crform_the_itemPriceCr_taxincluded( true, '', '', '', true, false, true, 'return' ); |
| 37 |
$html .= '</div>'; |
| 38 |
$singlestock = '<div class="field">' . esc_html__( 'stock status', 'usces' ) . ' : ' . esc_html( usces_get_itemZaiko( 'name' ) ) . '</div>'; |
| 39 |
$html .= apply_filters( 'single_item_stock_field', $singlestock ); |
| 40 |
$item_custom = usces_get_item_custom( $post->ID, 'list', 'return' ); |
| 41 |
if ( $item_custom ) { |
| 42 |
$html .= '<div class="field">'; |
| 43 |
$html .= $item_custom; |
| 44 |
$html .= '</div>'; |
| 45 |
} |
| 46 |
|
| 47 |
$html .= $content; |
| 48 |
$html .= '</div><!-- end of exp -->'; |
| 49 |
$html .= usces_the_itemGpExp( 'return' ); |
| 50 |
$html .= '<div class="skuform" align="right">'; |
| 51 |
if ( usces_is_options() ) { |
| 52 |
$html .= '<table class="item_option"><caption>' . apply_filters( 'usces_filter_single_item_options_caption', esc_html__( 'Please appoint an option.', 'usces' ), $post ) . '</caption>'; |
| 53 |
while ( usces_have_options() ) { |
| 54 |
$opttr = '<tr><th>' . esc_html( usces_getItemOptName() ) . '</th><td>' . usces_the_itemOption( usces_getItemOptName(), '', 'return' ) . '</td></tr>'; |
| 55 |
$html .= apply_filters( 'usces_filter_singleitem_option', $opttr, usces_getItemOptName(), null ); |
| 56 |
} |
| 57 |
$html .= '</table>'; |
| 58 |
} |
| 59 |
if ( ! usces_have_zaiko() ) { |
| 60 |
$html .= '<div class="zaiko_status">' . apply_filters( 'usces_filters_single_sku_zaiko_message', esc_html( usces_get_itemZaiko( 'name' ) ) ) . '</div>'; |
| 61 |
} else { |
| 62 |
$html .= '<div style="margin-top:10px">' . esc_html__( 'Quantity', 'usces' ) . usces_the_itemQuant( 'return' ) . esc_html( usces_the_itemSkuUnit( 'return' ) ) . usces_the_itemSkuButton( esc_html__( 'Add to Shopping Cart', 'usces' ), 0, 'return' ) . '</div>'; |
| 63 |
$html .= '<div class="error_message">' . usces_singleitem_error_message( $post->ID, usces_the_itemSku( 'return' ), 'return' ) . '</div>'; |
| 64 |
} |
| 65 |
|
| 66 |
$html .= '</div><!-- end of skuform -->'; |
| 67 |
$html .= apply_filters( 'single_item_single_sku_after_field', null ); |
| 68 |
|
| 69 |
} elseif ( 1 < usces_sku_num() ) { |
| 70 |
usces_have_skus(); |
| 71 |
|
| 72 |
$html .= '<h3>' . esc_html( usces_the_itemName( 'return' ) ) . ' (' . esc_html( usces_the_itemCode( 'return' ) ) . ') </h3>'; |
| 73 |
$html .= '<div class="exp clearfix">'; |
| 74 |
$html .= $content; |
| 75 |
$item_custom = usces_get_item_custom( $post->ID, 'list', 'return' ); |
| 76 |
if ( $item_custom ) { |
| 77 |
$html .= '<div class="field">'; |
| 78 |
$html .= $item_custom; |
| 79 |
$html .= '</div>'; |
| 80 |
} |
| 81 |
$html .= '</div>'; |
| 82 |
|
| 83 |
$html .= '<div class="skuform">'; |
| 84 |
$html .= '<table class="skumulti">'; |
| 85 |
$html .= '<thead>'; |
| 86 |
$html .= '<tr>'; |
| 87 |
$html .= '<th rowspan="2" class="thborder">' . esc_html__( 'order number', 'usces' ) . '</th>'; |
| 88 |
$html .= '<th colspan="2">' . esc_html__( 'Title', 'usces' ) . '</th>'; |
| 89 |
if ( 0 < usces_the_itemCprice( 'return' ) ) { |
| 90 |
$usces_bothprice = '(' . esc_html__( 'List price', 'usces' ) . ')' . esc_html__( 'selling price', 'usces' ) . usces_guid_tax( 'return' ); |
| 91 |
$html .= '<th colspan="2">' . apply_filters( 'usces_filter_bothprice_label', $usces_bothprice, esc_html__( 'List price', 'usces' ), esc_html__( 'selling price', 'usces' ), usces_guid_tax( 'return' ) ) . '</th>'; |
| 92 |
} else { |
| 93 |
$usces_sellingprice = esc_html__( 'selling price', 'usces' ) . usces_guid_tax( 'return' ); |
| 94 |
$html .= '<th colspan="2">' . apply_filters( 'usces_filter_sellingprice_label', $usces_sellingprice, esc_html__( 'selling price', 'usces' ), usces_guid_tax( 'return' ) ) . '</th>'; |
| 95 |
} |
| 96 |
$html .= '</tr>'; |
| 97 |
$html .= '<tr>'; |
| 98 |
$html .= '<th class="thborder">' . esc_html__( 'stock status', 'usces' ) . '</th>'; |
| 99 |
$html .= '<th class="thborder">' . esc_html__( 'Quantity', 'usces' ) . '</th>'; |
| 100 |
$html .= '<th class="thborder">' . esc_html__( 'unit', 'usces' ) . '</th>'; |
| 101 |
$html .= '<th class="thborder"> </th>'; |
| 102 |
$html .= '</tr>'; |
| 103 |
$html .= '</thead>'; |
| 104 |
$html .= '<tbody>'; |
| 105 |
do { |
| 106 |
$html .= '<tr>'; |
| 107 |
$html .= '<td rowspan="2">' . esc_html( usces_the_itemSku( 'return' ) ) . '</td>'; |
| 108 |
$html .= '<td colspan="2" class="skudisp subborder">' . apply_filters( 'usces_filter_singleitem_skudisp', esc_html( usces_the_itemSkuDisp( 'return' ) ) ); |
| 109 |
if ( usces_is_options() ) { |
| 110 |
$html .= '<table class="item_option"><caption>' . apply_filters( 'usces_filter_single_item_options_caption', esc_html__( 'Please appoint an option.', 'usces' ), $post ) . '</caption>'; |
| 111 |
while ( usces_have_options() ) { |
| 112 |
$opttr = '<tr><th>' . esc_html( usces_getItemOptName() ) . '</th><td>' . usces_the_itemOption( usces_getItemOptName(), '', 'return' ) . '</td></tr>'; |
| 113 |
$html .= apply_filters( 'usces_filter_singleitem_option', $opttr, usces_getItemOptName(), null ); |
| 114 |
} |
| 115 |
$html .= '</table>'; |
| 116 |
} |
| 117 |
$html .= '</td>'; |
| 118 |
$html .= '<td colspan="2" class="subborder price">'; |
| 119 |
if ( 0 < usces_the_itemCprice( 'return' ) ) { |
| 120 |
$html .= '<span class="cprice">(' . usces_the_itemCpriceCr( 'return' ) . ')</span>'; |
| 121 |
} |
| 122 |
$html .= '<span class="price">' . usces_the_itemPriceCr( 'return' ) . '</span>'; |
| 123 |
$html .= usces_crform_the_itemPriceCr_taxincluded( true, '', '', '', true, false, true, 'return' ); |
| 124 |
$html .= '<br />' . usces_the_itemGpExp( 'return' ) . '</td>'; |
| 125 |
$html .= '</tr>'; |
| 126 |
$html .= '<tr>'; |
| 127 |
$html .= '<td class="zaiko">' . usces_get_itemZaiko( 'name' ) . '</td>'; |
| 128 |
$html .= '<td class="quant">' . usces_the_itemQuant( 'return' ) . '</td>'; |
| 129 |
$html .= '<td class="unit">' . usces_the_itemSkuUnit( 'return' ) . '</td>'; |
| 130 |
if ( ! usces_have_zaiko() ) { |
| 131 |
$html .= '<td class="button">' . apply_filters( 'usces_filters_single_sku_zaiko_message', esc_html( usces_get_itemZaiko( 'name' ) ) ) . '</td>'; |
| 132 |
} else { |
| 133 |
$html .= '<td class="button">' . usces_the_itemSkuButton( esc_html__( 'Add to Shopping Cart', 'usces' ), 0, 'return' ) . '</td>'; |
| 134 |
} |
| 135 |
$html .= '</tr>'; |
| 136 |
$html .= '<tr><td colspan="5" class="error_message">' . usces_singleitem_error_message( $post->ID, usces_the_itemSku( 'return' ), 'return' ) . '</td></tr>'; |
| 137 |
|
| 138 |
} while ( usces_have_skus() ); |
| 139 |
$html .= '</tbody>'; |
| 140 |
$html .= '</table>'; |
| 141 |
$html .= '</div><!-- end of skuform -->'; |
| 142 |
$html .= apply_filters( 'single_item_multi_sku_after_field', null ); |
| 143 |
} |
| 144 |
|
| 145 |
$html .= '<div class="itemsubimg">'; |
| 146 |
$imageid = usces_get_itemSubImageNums(); |
| 147 |
foreach ( $imageid as $id ) { |
| 148 |
$html .= '<a href="' . usces_the_itemImageURL( $id, 'return' ) . '"'; |
| 149 |
$html .= apply_filters( 'usces_itemimg_anchor_rel', '' ); |
| 150 |
$html .= '>'; |
| 151 |
$item_image = usces_the_itemImage( $id, 137, 200, $post, 'return' ); |
| 152 |
$html .= apply_filters( 'usces_filter_the_SubImage', $item_image, $post, $id ); |
| 153 |
$html .= '</a>'; |
| 154 |
} |
| 155 |
$html .= '</div><!-- end of itemsubimg -->'; |
| 156 |
|
| 157 |
if ( usces_get_assistance_id_list( $post->ID ) ) { |
| 158 |
$post_id = $post->ID; |
| 159 |
|
| 160 |
$html .= '<div class="assistance_item">'; |
| 161 |
|
| 162 |
$r = new WP_Query( array( 'post__in' => usces_get_assistance_ids( $post_id ), 'ignore_sticky_posts' => 1 ) ); |
| 163 |
if ( $r->have_posts() ) { |
| 164 |
add_filter( 'excerpt_length', 'welcart_assistance_excerpt_length' ); |
| 165 |
add_filter( 'excerpt_mblength', 'welcart_assistance_excerpt_mblength' ); |
| 166 |
$width = apply_filters( 'usces_filter_assistance_item_width', 100 ); |
| 167 |
$height = apply_filters( 'usces_filter_assistance_item_height', 100 ); |
| 168 |
|
| 169 |
$assistance_item_title = '<h3>' . esc_html( usces_the_itemCode( 'return' ) ) . esc_html__( 'An article concerned', 'usces' ) . '</h3>'; |
| 170 |
$html .= apply_filters( 'usces_assistance_item_title', $assistance_item_title ); |
| 171 |
$html .= '<ul class="clearfix">'; |
| 172 |
while ( $r->have_posts() ) { |
| 173 |
$r->the_post(); |
| 174 |
usces_remove_filter(); |
| 175 |
usces_the_item(); |
| 176 |
$html .= '<li><div class="listbox clearfix">'; |
| 177 |
$html .= '<div class="slit"><a href="' . get_permalink() . '" rel="bookmark" title="' . esc_attr( get_the_title() ) . '">' . usces_the_itemImage( 0, $width, $height, $post, 'return' ) . '</a></div>'; |
| 178 |
$html .= '<div class="detail">'; |
| 179 |
$html .= '<h4>' . esc_html( usces_the_itemName( 'return' ) ) . '</h4>'; |
| 180 |
$html .= get_the_excerpt(); |
| 181 |
$html .= '<p>'; |
| 182 |
if ( usces_is_skus() ) { |
| 183 |
$html .= usces_crform( usces_the_firstPrice( 'return' ), true, false, 'return' ); |
| 184 |
} |
| 185 |
$html .= '<br />'; |
| 186 |
$html .= '» <a href="' . get_permalink() . '" rel="bookmark" title="' . esc_attr( get_the_title() ) . '">' . esc_html__( 'see the details', 'usces' ) . '</a></p>'; |
| 187 |
$html .= '</div>'; |
| 188 |
$html .= '</div>'; |
| 189 |
$html .= '</li>'; |
| 190 |
} |
| 191 |
$html .= '</ul>'; |
| 192 |
wp_reset_postdata(); |
| 193 |
usces_reset_filter(); |
| 194 |
remove_filter( 'excerpt_length', 'welcart_assistance_excerpt_length' ); |
| 195 |
remove_filter( 'excerpt_mblength', 'welcart_assistance_excerpt_mblength' ); |
| 196 |
} |
| 197 |
$html .= '</div><!-- end of assistance_item -->'; |
| 198 |
} |
| 199 |
|
| 200 |
$html = apply_filters( 'usces_filter_single_item_inform', $html ); |
| 201 |
$html .= '</form>'; |
| 202 |
$html .= apply_filters( 'usces_filter_single_item_outform', null ); |
| 203 |
|
| 204 |
$html .= '</div><!-- end of itemspage -->'; |
| 205 |
$html = apply_filters( 'usces_filter_single_item', $html, $post, $content ); |
| 206 |
|