我正在WordPress的WooCommerce中使用YITH Wishlist。
在单个愿望清单中-它显示图像,并带有“从列表中删除”,产品标题以及指向单个产品的链接。
因此,当我在“管理愿望清单”页面中显示单个愿望清单时,向“文件夹”上移一步,我只能显示列表的名称以及指向该单个列表的链接,您可以在其中看到所有产品分组。我希望在这里显示“单个愿望清单中的第一款产品”的第一张图片或缩略图。
我已经多次尝试并破坏了脚本。那里有人可以帮助我收集脚本,以抓取该图像并将其显示在“管理愿望清单”页面中吗?更好的是,还有谁知道为我执行此操作的简码(如果有这样的事情)?
这里是几乎所有与库存相关的模板文件...
这是管理页面模板(如果您按ctrl + f表示“我要在此处显示图像”以查看要在其中显示图像的位置)-我想在哪里显示图像:
<?php
/**
* Wishlist manage template
*
* @author Your Inspiration Themes
* @package YITH WooCommerce Wishlist
* @version 2.0.5
*/
if ( ! defined( 'YITH_WCWL' ) ) {
exit;
} // Exit if accessed directly
?>
<form id="yith-wcwl-form" action="<?php echo esc_url( YITH_WCWL()->get_wishlist_url( 'manage' ) ) ?>" method="post">
<!-- TITLE -->
<?php
do_action( 'yith_wcwl_before_wishlist_title' );
if( ! empty( $page_title ) ) {
echo apply_filters( 'yith_wcwl_wishlist_title', '<h2 class="h1 blue lh2 mt2 mb0 p0">Manage My Boards</h2>' );
}
do_action( 'yith_wcwl_before_wishlist_manage' );
?>
<table class="shop_table cart wishlist_table wishlist_manage_table" cellspacing="0" >
<thead>
<tr>
<th class="wishlist-name">
<span class="nobr">
Boards
<?php // echo apply_filters( 'yith_wcwl_wishlist_manage_name_heading', __( 'Wishlists', 'yith-woocommerce-wishlist' ) ) ?>
</span>
</th>
<?php /* ?>
<th class="wishlist-privacy">
<span class="nobr">
<?php echo apply_filters( 'yith_wcwl_wishlist_manage_privacy_heading', __( 'Privacy', 'yith-woocommerce-wishlist' ) ) ?>
</span>
</th>
<?php */ ?>
<th class="wishlist-delete">
<span class="nobr">
<?php echo apply_filters( 'yith_wcwl_wishlist_manage_delete_heading', __( 'Delete', 'yith-woocommerce-wishlist' ) ) ?>
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<td class="wishlist-name">
<a title="<?php echo $default_wishlist_title ?>" class="wishlist-anchor" href="<?php echo YITH_WCWL()->get_wishlist_url( 'user' . '/' . $current_user_id ) ?>">
<?php echo $default_wishlist_title ?>
</a>
</td>
<?php /* ?>
<td class="wishlist-privacy">
<?php echo apply_filters( 'yith_wcwl_wishlist_manage_default_privacy', __( 'Public', 'yith-woocommerce-wishlist' ) )?>
</td>
<?php */ ?>
<td class="wishlist-delete"></td>
</tr>
<?php
$wishlist_count = 0;
if( ! empty( $user_wishlists ) ):
?>
<?php foreach( $user_wishlists as $wishlist ): ?>
<?php if( ! $wishlist['is_default'] ): ?>
<tr>
<td class="wishlist-name">
<a title="<?php echo $wishlist['wishlist_name'] ?>" class="wishlist-anchor" href="<?php echo YITH_WCWL()->get_wishlist_url( 'view' . '/' . $wishlist['wishlist_token'] ) ?>">
<!-- I WANT TO SHOW IMAGE HERE (OF THE FIRST PRODUCT IN THE WISHLIST CURRENTLY BEING LOOPED THROUGH) -->
<?php echo $wishlist['wishlist_name'] ?>
</a>
</td>
<?php /* ?>
<td class="wishlist-privacy">
<select name="wishlist_options[<?php echo $wishlist['ID'] ?>][wishlist_privacy]" class="wishlist-visibility selectBox">
<option value="0" class="public-visibility" <?php selected( $wishlist['wishlist_privacy'], 0 ) ?> ><?php echo apply_filters( 'yith_wcwl_public_wishlist_visibility', __( 'Public', 'yith-woocommerce-wishlist' ) )?></option>
<option value="1" class="shared-visibility" <?php selected( $wishlist['wishlist_privacy'], 1 ) ?> ><?php echo apply_filters( 'yith_wcwl_shared_wishlist_visibility', __( 'Shared', 'yith-woocommerce-wishlist' ) )?></option>
<option value="2" class="private-visibility" <?php selected( $wishlist['wishlist_privacy'], 2 ) ?> ><?php echo apply_filters( 'yith_wcwl_private_wishlist_visibility', __( 'Private', 'yith-woocommerce-wishlist' ) )?></option>
</select>
</td>
<?php */ ?>
<td class="wishlist-delete">
<!-- <input type="checkbox" value="yes" name="wishlist_options[<?php echo $wishlist['ID'] ?>][delete]"/> -->
<a class="button" href="<?php echo esc_url( add_query_arg( 'wishlist_id', $wishlist['ID'], wp_nonce_url( YITH_WCWL()->get_wishlist_url( 'manage' ), 'yith_wcwl_delete_action', 'yith_wcwl_delete' ) ) ) ?>"><?php _e( 'Delete', 'yith-woocommerce-wishlist' ) ?></a>
</td>
</tr>
<?php
$wishlist_count ++;
endif;
?>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
<tfoot>
<tr>
<td colspan="3">
<a class="btn button create-new-wishlist" href="<?php echo YITH_WCWL()->get_wishlist_url( 'create' ) ?>">
<?php echo apply_filters( 'yith_wcwl_create_new_wishlist_icon', '<i class="icon-plus"></i>' )?>
<?php echo apply_filters( 'yith_wcwl_create_new_wishlist_title', __( 'Create a new board', 'yith-woocommerce-wishlist' ) )?>
</a>
<?php if( ! empty( $user_wishlists ) && $wishlist_count ): ?>
<button class="submit-wishlist-changes">
<?php echo apply_filters( 'yith_wcwl_mange_wishlist_icon', '<i class="icon-ok"></i>' )?>
<?php _e( 'Save Settings', 'yith-woocommerce-wishlist' ) ?>
</button>
<?php endif; ?>
</td>
</tr>
</tfoot>
</table>
<?php wp_nonce_field( 'yith_wcwl_manage_action', 'yith_wcwl_manage' )?>
<?php do_action( 'yith_wcwl_after_wishlist_manage' ); ?>
</form>
这是个人愿望清单页面,其中包含正在显示的产品图像脚本(ctrl + f“成功抓取图像”以获取相关代码)-在哪里可以看到通过产品将图像拉出的工作示例:
<?php
/**
* Wishlist page template
*
* @author Your Inspiration Themes
* @package YITH WooCommerce Wishlist
* @version 2.0.12
*/
if ( ! defined( 'YITH_WCWL' ) ) {
exit;
} // Exit if accessed directly
?>
<script type="text/javascript">
var root = document.documentElement;
root.className += ' wishlist-view';
</script>
<?php do_action( 'yith_wcwl_before_wishlist_form', $wishlist_meta ); ?>
<?php
function cmp($a, $b) {
if ($a == $b) {
return 0;
}
return ($a < $b) ? -1 : 1;
}
uasort($users_wishlists, 'cmp');
?>
<?php /* ?>
<pre><code>
<?php
print_r($wishlist_items);
// print_r($users_wishlists);
?>
</code></pre>
<?php */ ?>
<!--
<div class="my-materials-sidebar bg-dark-blue white lg:absolute top-0 left-0 bottom-0">
<div class="bg-darken-3 p2 lg:p3 height-100 overflow-auto">
<h3 class="h1 mt0">My Materials</h3>
<h3 class="h2 lg:h1 mb1">My Boards</h3>
<ul class="list-reset my3 p0 uppercase lg:h3">
<li><a href="/my-materials/create">Add new board</a></li>
<li><a href="/my-materials/manage">Manage boards</a></li>
</ul>
<ul class="list-reset m0 p0 uppercase lg:h3 boards">
<?php foreach ($users_wishlists as $users_wishlist) : ?>
<?php
$token = $users_wishlist['wishlist_token'];
$name = $users_wishlist['wishlist_name'];
?>
<?php /* <pre><code><?php print_r($users_wishlist); ?></code></pre> */ ?>
<li>
<?php if( $name ) : ?>
<a href="/my-materials/view/<?php echo $token; ?>">
<?php echo $name; ?>
</a>
<?php else : ?>
<a href="/my-materials">
Main board
</a>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<ul class="list-reset m0 p0 uppercase lg:h3">
<li>
<a href="/my-account/">My account</a>
</li>
<li>
<a href="/my-account<?php echo wc_logout_url('/') ?>">Log out</a>
</li>
</ul>
</div>
</div>
-->
<form id="yith-wcwl-form" action="<?php echo $form_action ?>" method="post" class="woocommerce">
<?php wp_nonce_field( 'yith-wcwl-form', 'yith_wcwl_form_nonce' ) ?>
<!-- TITLE -->
<?php
do_action( 'yith_wcwl_before_wishlist_title', $wishlist_meta );
if( ! empty( $page_title ) ) :
?>
<a href="/my-materials/manage" class="btn dark-grey hover:black right">All Boards</a>
<?php if( count( $wishlist_items ) > 0 ) : ?>
<a href="#" class="btn dark-grey hover:black right" data-edit-board>Edit Board</a>
<?php else : ?>
<?php endif; ?>
<div class="wishlist-title <?php echo ( $is_custom_list ) ? 'wishlist-title-with-form' : ''?>">
<?php echo apply_filters( 'yith_wcwl_wishlist_title', '<h2 class="h1 blue lh2 mt2 mb0 p0">' . $page_title . '</h2>' ); ?>
<?php /* if( $is_custom_list ): ?>
<a class="btn button show-title-form">
<?php echo apply_filters( 'yith_wcwl_edit_title_icon', '<i class="fa fa-pencil"></i>' )?>
<?php _e( 'Edit title', 'yith-woocommerce-wishlist' ) ?>
</a>
<?php endif; */ ?>
</div>
<?php if( $is_custom_list ): ?>
<div class="hidden-title-form">
<input type="text" value="<?php echo $page_title ?>" name="wishlist_name"/>
<button class="button">
<?php echo apply_filters( 'yith_wcwl_save_wishlist_title_icon', '<i class="fa fa-check fa-fw"></i>' )?>
<span>
<?php _e( 'Save', 'yith-woocommerce-wishlist' )?>
</span>
</button>
<a class="hide-title-form btn button">
<?php echo apply_filters( 'yith_wcwl_cancel_wishlist_title_icon', '<i class="fa fa-remove fa-fw"></i>' )?>
<span>
<?php _e( 'Cancel', 'yith-woocommerce-wishlist' )?>
</span>
</a>
</div>
<?php endif; ?>
<?php
endif;
do_action( 'yith_wcwl_before_wishlist', $wishlist_meta ); ?>
<?php /* ?>
<ul class="products columns-4">
<?php if( count( $wishlist_items ) > 0 ) :
$added_items = array();
foreach( $wishlist_items as $item ) :
global $product;
$item['prod_id'] = yit_wpml_object_id ( $item['prod_id'], 'product', true );
if( in_array( $item['prod_id'], $added_items ) ){
continue;
}
$added_items[] = $item['prod_id'];
$product = wc_get_product( $item['prod_id'] );
$availability = $product->get_availability();
$stock_status = $availability['class'];
if( $product && $product->exists() ) :
?>
<li class="product">
<a href="<?php echo esc_url( get_permalink( apply_filters( 'woocommerce_in_cart_product', $item['prod_id'] ) ) ) ?>">
<?php echo $product->get_image() ?>
<h2 class="woocommerce-loop-product__title"><?php echo apply_filters( 'woocommerce_in_cartproduct_obj_title', $product->get_title(), $product ) ?></h2>
<?php do_action( 'yith_wcwl_table_after_product_name', $item ); ?>
</a>
<?php if( $is_user_owner ): ?>
<div class="product-remove">
<a href="<?php echo esc_url( add_query_arg( 'remove_from_wishlist', $item['prod_id'] ) ) ?>" class="remove remove_item_from_wishlist" title="<?php _e( 'Remove this product', 'yith-woocommerce-wishlist' ) ?>">×</a>
</div>
<?php endif; ?>
<?php if( $available_multi_wishlist && is_user_logged_in() && count( $users_wishlists ) > 1 && $move_to_another_wishlist && $is_user_owner ): ?>
<select class="change-wishlist selectBox-">
<option value=""><?php _e( 'Move', 'yith-woocommerce-wishlist' ) ?></option>
<?php
foreach( $users_wishlists as $wl ):
if( $wl['wishlist_token'] == $wishlist_meta['wishlist_token'] ){
continue;
}
?>
<option value="<?php echo esc_attr( $wl['wishlist_token'] ) ?>">
<?php
$wl_title = ! empty( $wl['wishlist_name'] ) ? esc_html( $wl['wishlist_name'] ) : esc_html( $default_wishlsit_title );
if( $wl['wishlist_privacy'] == 1 ){
$wl_privacy = __( 'Shared', 'yith-woocommerce-wishlist' );
}
elseif( $wl['wishlist_privacy'] == 2 ){
$wl_privacy = __( 'Private', 'yith-woocommerce-wishlist' );
}
else{
$wl_privacy = __( 'Public', 'yith-woocommerce-wishlist' );
}
// echo sprintf( '%s - %s', $wl_title, $wl_privacy );
echo sprintf( '%s', $wl_title );
?>
</option>
<?php
endforeach;
?>
</select>
<?php endif; ?>
</li>
<?php
endif;
endforeach;
else: ?>
<?php endif; ?>
</ul>
<?php */ ?>
<?php ?>
<!-- WISHLIST TABLE -->
<table class="shop_table cart wishlist_table" data-pagination="<?php echo esc_attr( $pagination )?>" data-per-page="<?php echo esc_attr( $per_page )?>" data-page="<?php echo esc_attr( $current_page )?>" data-id="<?php echo $wishlist_id ?>" data-token="<?php echo $wishlist_token ?>">
<?php $column_count = 2; ?>
<thead>
<tr>
<?php if( $show_cb ) : ?>
<th class="product-checkbox">
<input type="checkbox" value="" name="" id="bulk_add_to_cart"/>
</th>
<?php
$column_count ++;
endif;
?>
<?php if( $is_user_owner ): ?>
<th class="product-remove"></th>
<?php
$column_count ++;
endif;
?>
<th class="product-thumbnail"></th>
<th class="product-name">
<span class="nobr"><?php echo apply_filters( 'yith_wcwl_wishlist_view_name_heading', __( 'Product Name', 'yith-woocommerce-wishlist' ) ) ?></span>
</th>
<?php if( $show_price ) : ?>
<th class="product-price">
<span class="nobr">
<?php echo apply_filters( 'yith_wcwl_wishlist_view_price_heading', __( 'Unit Price', 'yith-woocommerce-wishlist' ) ) ?>
</span>
</th>
<?php
$column_count ++;
endif;
?>
<?php if( $show_stock_status ) : ?>
<th class="product-stock-status">
<span class="nobr">
<?php echo apply_filters( 'yith_wcwl_wishlist_view_stock_heading', __( 'Stock Status', 'yith-woocommerce-wishlist' ) ) ?>
</span>
</th>
<?php
$column_count ++;
endif;
?>
<?php if( $show_last_column ) : ?>
<th class="product-move"></th>
<?php
$column_count ++;
endif;
?>
</tr>
</thead>
<tbody>
<?php
if( count( $wishlist_items ) > 0 ) :
$added_items = array();
foreach( $wishlist_items as $item ) :
global $product;
$item['prod_id'] = yit_wpml_object_id ( $item['prod_id'], 'product', true );
if( in_array( $item['prod_id'], $added_items ) ){
continue;
}
$added_items[] = $item['prod_id'];
$product = wc_get_product( $item['prod_id'] );
$availability = $product->get_availability();
$stock_status = $availability['class'];
if( $product && $product->exists() ) :
?>
<tr id="yith-wcwl-row-<?php echo $item['prod_id'] ?>" data-row-id="<?php echo $item['prod_id'] ?>">
<?php if( $show_cb ) : ?>
<td class="product-checkbox">
<input type="checkbox" value="<?php echo esc_attr( $item['prod_id'] ) ?>" name="add_to_cart[]" <?php echo ( ! $product->is_type( 'simple' ) ) ? 'disabled="disabled"' : '' ?>/>
</td>
<?php endif ?>
<?php if( $is_user_owner ): ?>
<td class="product-remove">
<div>
<a href="<?php echo esc_url( add_query_arg( 'remove_from_wishlist', $item['prod_id'] ) ) ?>" class="remove remove_from_wishlist" title="<?php // _e( 'Remove this item', 'yith-woocommerce-wishlist' ) ?>">×</a>
</div>
</td>
<?php endif; ?>
<td class="product-thumbnail">
<a href="<?php echo esc_url( get_permalink( apply_filters( 'woocommerce_in_cart_product', $item['prod_id'] ) ) ) ?>">
<!-- THIS IS GRABBING THE IMAGE SUCCESFULLY -->
<?php echo $product->get_image() ?>
<h2 class="product-name"><?php echo apply_filters( 'woocommerce_in_cartproduct_obj_title', $product->get_title(), $product ) ?></h2>
<?php do_action( 'yith_wcwl_table_after_product_name', $item ); ?>
</a>
</td>
<?php /* ?>
<td class="product-name">
<a href="<?php echo esc_url( get_permalink( apply_filters( 'woocommerce_in_cart_product', $item['prod_id'] ) ) ) ?>"><?php echo apply_filters( 'woocommerce_in_cartproduct_obj_title', $product->get_title(), $product ) ?></a>
<?php do_action( 'yith_wcwl_table_after_product_name', $item ); ?>
</td>
<?php */ ?>
<?php if( $show_price ) : ?>
<td class="product-price">
<?php
$base_product = $product->is_type( 'variable' ) ? $product->get_variation_regular_price( 'max' ) : $product->get_price();
echo $base_product ? $product->get_price_html() : apply_filters( 'yith_free_text', __( 'Free!', 'yith-woocommerce-wishlist' ) );
?>
</td>
<?php endif ?>
<?php if( $show_stock_status ) : ?>
<td class="product-stock-status">
<?php echo $stock_status == 'out-of-stock' ? '<span class="wishlist-out-of-stock">' . __( 'Out of Stock', 'yith-woocommerce-wishlist' ) . '</span>' : '<span class="wishlist-in-stock">' . __( 'In Stock', 'yith-woocommerce-wishlist' ) . '</span>'; ?>
</td>
<?php endif ?>
<?php if( $show_last_column ): ?>
<td class="product-move">
<!-- Date added -->
<?php
if( $show_dateadded && isset( $item['dateadded'] ) ):
echo '<span class="dateadded">' . sprintf( __( 'Added on : %s', 'yith-woocommerce-wishlist' ), date_i18n( get_option( 'date_format' ), strtotime( $item['dateadded'] ) ) ) . '</span>';
endif;
?>
<!-- Add to cart button -->
<?php if( $show_add_to_cart && isset( $stock_status ) && $stock_status != 'out-of-stock' ): ?>
<?php woocommerce_template_loop_add_to_cart(); ?>
<?php endif ?>
<!-- Change wishlist -->
<?php if( $available_multi_wishlist && is_user_logged_in() && count( $users_wishlists ) > 1 && $move_to_another_wishlist && $is_user_owner ): ?>
<div class="product-move-trigger">
<!-- <img src="<?php echo get_template_directory_uri(); ?>/assets/img/plus-white.svg" alt="" class=""> -->
</div>
<div class="product-move-dropdown">
<h3>Move to Board</h3>
<select class="change-wishlist selectBox- select">
<option value=""><?php _e( 'Choose...', 'yith-woocommerce-wishlist' ) ?></option>
<?php
foreach( $users_wishlists as $wl ):
if( $wl['wishlist_token'] == $wishlist_meta['wishlist_token'] ){
continue;
}
?>
<option value="<?php echo esc_attr( $wl['wishlist_token'] ) ?>">
<?php
$wl_title = ! empty( $wl['wishlist_name'] ) ? esc_html( $wl['wishlist_name'] ) : esc_html( $default_wishlsit_title );
if( $wl['wishlist_privacy'] == 1 ){
$wl_privacy = __( 'Shared', 'yith-woocommerce-wishlist' );
}
elseif( $wl['wishlist_privacy'] == 2 ){
$wl_privacy = __( 'Private', 'yith-woocommerce-wishlist' );
}
else{
$wl_privacy = __( 'Public', 'yith-woocommerce-wishlist' );
}
if ( $wl_title == 'My Materials' ) {
$wl_title = 'Main board';
}
// echo sprintf( '%s - %s', $wl_title, $wl_privacy );
echo sprintf( '%s', $wl_title );
?>
</option>
<?php
endforeach;
?>
</select>
</div>
<?php endif; ?>
<!-- Remove from wishlist -->
<?php if( $is_user_owner && $repeat_remove_button ): ?>
<a href="<?php echo esc_url( add_query_arg( 'remove_from_wishlist', $item['prod_id'] ) ) ?>" class="remove_from_wishlist button" title="<?php _e( 'Remove this product', 'yith-woocommerce-wishlist' ) ?>"><?php _e( 'Remove', 'yith-woocommerce-wishlist' ) ?></a>
<?php endif; ?>
</td>
<?php endif; ?>
</tr>
<?php
endif;
endforeach;
else: ?>
<tr class="empty">
<td colspan="<?php echo esc_attr( $column_count ) ?>" class="wishlist-empty"><?php echo apply_filters( 'yith_wcwl_no_product_to_remove_message', __( 'No items have been added to this board yet', 'yith-woocommerce-wishlist' ) ) ?></td>
</tr>
<?php
endif;
if( ! empty( $page_links ) ) : ?>
<tr class="pagination-row">
<td colspan="<?php echo esc_attr( $column_count ) ?>"><?php echo $page_links ?></td>
</tr>
<?php endif ?>
</tbody>
<tfoot>
<tr>
<td colspan="<?php echo esc_attr( $column_count ) ?>">
<?php if( $show_cb ) : ?>
<div class="custom-add-to-cart-button-cotaniner">
<a href="<?php echo esc_url( add_query_arg( array( 'wishlist_products_to_add_to_cart' => '', 'wishlist_token' => $wishlist_token ) ) ) ?>" class="button alt" id="custom_add_to_cart"><?php echo apply_filters( 'yith_wcwl_custom_add_to_cart_text', __( 'Add the selected products to the cart', 'yith-woocommerce-wishlist' ) ) ?></a>
</div>
<?php endif; ?>
<?php if ( $is_user_owner && $show_ask_estimate_button && $count > 0 ): ?>
<div class="ask-an-estimate-button-container">
<a href="<?php echo ( $additional_info || ! is_user_logged_in() ) ? '#ask_an_estimate_popup' : $ask_estimate_url ?>" class="btn button ask-an-estimate-button" <?php echo ( $additional_info ) ? 'data-rel="prettyPhoto[ask_an_estimate]"' : '' ?> >
<?php echo apply_filters( 'yith_wcwl_ask_an_estimate_icon', '<i class="fa fa-shopping-cart"></i>' )?>
<?php echo apply_filters( 'yith_wcwl_ask_an_estimate_text', __( 'Ask for an estimate', 'yith-woocommerce-wishlist' ) ) ?>
</a>
</div>
<?php endif; ?>
<?php
do_action( 'yith_wcwl_before_wishlist_share', $wishlist_meta );
if ( is_user_logged_in() && $is_user_owner && ! $is_private && $share_enabled ){
yith_wcwl_get_template( 'share.php', $share_atts );
}
do_action( 'yith_wcwl_after_wishlist_share', $wishlist_meta );
?>
</td>
</tr>
</tfoot>
</table>
<?php ?>
<?php wp_nonce_field( 'yith_wcwl_edit_wishlist_action', 'yith_wcwl_edit_wishlist' ); ?>
<?php if( ! $is_default ): ?>
<input type="hidden" value="<?php echo $wishlist_token ?>" name="wishlist_id" id="wishlist_id">
<?php endif; ?>
<?php do_action( 'yith_wcwl_after_wishlist', $wishlist_meta ); ?>
</form>
<?php do_action( 'yith_wcwl_after_wishlist_form', $wishlist_meta ); ?>
<?php if( $show_ask_estimate_button && ( ! is_user_logged_in() || $additional_info ) ): ?>
<div id="ask_an_estimate_popup">
<form action="<?php echo $ask_estimate_url ?>" method="post" class="wishlist-ask-an-estimate-popup">
<?php if( ! is_user_logged_in() ): ?>
<label for="reply_email"><?php echo apply_filters( 'yith_wcwl_ask_estimate_reply_mail_label', __( 'Your email', 'yith-woocommerce-wishlist' ) ) ?></label>
<input type="email" value="" name="reply_email" id="reply_email">
<?php endif; ?>
<?php if( ! empty( $additional_info_label ) ):?>
<label for="additional_notes"><?php echo esc_html( $additional_info_label ) ?></label>
<?php endif; ?>
<textarea id="additional_notes" name="additional_notes"></textarea>
<button class="btn button ask-an-estimate-button ask-an-estimate-button-popup" >
<?php echo apply_filters( 'yith_wcwl_ask_an_estimate_icon', '<i class="fa fa-shopping-cart"></i>' )?>
<?php echo apply_filters( 'yith_wcwl_ask_an_estimate_text', __( 'Ask for an estimate', 'yith-woocommerce-wishlist' ) ) ?>
</button>
</form>
</div>
<?php endif; ?>
我知道该脚本无法直接复制,因为它正在浏览产品变量,从而知道正在浏览的产品,所以我需要编写类似的内容,而不是在产品内部。
我想我知道我需要做什么,我只是不知道该怎么做...
我尝试了一些简单的东西,甚至在实现之前就无法使用。尝试猜测简码/在网上搜寻简码列表。非常感谢所有帮助。
谢谢杰森。
编辑:尝试使用'simplehtmldom'实现此目标...
我已经下载并安装了simplehtmldom,然后将其命名为文件:
<?php
$simplehtmldom = get_template_directory() . "/simplehtmldom/simple_html_dom.php";
include_once($simplehtmldom);
?>
然后继续通过收集该愿望清单中第一个产品的src来尝试在愿望清单中查找图像:
<?php
$boardlink = YITH_WCWL()->get_wishlist_url( 'view' . '/' . $wishlist['wishlist_token'] );
$html = file_get_html($boardlink);
$wishlistimage = $html->find('.attachment-woocommerce_thumbnail', 0)->src;
?>
变量$ boardlink值已从以下部分的href中获取:
<a title="<?php echo $wishlist['wishlist_name'] ?>" class="wishlist-anchor" href="<?php echo YITH_WCWL()->get_wishlist_url( 'view' . '/' . $wishlist['wishlist_token'] ) ?>">
从技术上讲,应该/可以工作...
但是,我遇到了一系列错误:
警告:file_get_contents():SSL操作失败,代码为1。OpenSSL错误消息:error:14090086:SSL例程:ssl3_get_server_certificate:证书在/ home / example / public_html / development / wp-content / themes / bolt /中验证失败第136行的simplehtmldom / simple_html_dom.php
警告:file_get_contents():无法在第136行的/home/example/public_html/development/wp-content/themes/bolt/simplehtmldom/simple_html_dom.php中启用加密
警告:file_get_contents(https://development.example.com/my-materials/view/9OW01M6785H9/):无法打开流:在第136行的/home/example/public_html/development/wp-content/themes/bolt/simplehtmldom/simple_html_dom.php中操作失败
此站点没有有效的SSL,因为它只是一个暂存开发站点。该实时站点确实具有SSL。
我认为主要的问题是愿望清单是用户专用的,我认为我们无法从这些页面中抓取信息。
谢谢杰森。