<th class="product-name">&nbsp;</th>
			<th class="product-price">&nbsp;</th>
			<th class="product-add-to-cart">&nbsp;</th>
            <th class="product-remove">&nbsp;</th>
		</tr>
	</thead>
	<tbody>
    <?php 
$i = 1;
foreach ($aUsersWishlist as $iProductId => $aWshlistItemData) {
    if ($aWshlistItemData['type'] == 'variable' && !empty($aWshlistItemData['vid'])) {
        foreach ($aWshlistItemData['vid'] as $iVariableProductId) {
            $oProduct = new WC_Product_Variation($iVariableProductId, $iProductId);
            if ($oProduct->exists()) {
                include UniWishlist()->plugin_path() . '/includes/views/item-variation-table-row.php';
            }
        }
    } else {
        $oProduct = new WC_Product($iProductId);
        if ($oProduct->exists()) {
            include UniWishlist()->plugin_path() . '/includes/views/item-table-row.php';
        }
    }
    $i++;
}
?>
    </tbody>
</table>

<?php 
do_action('uni_wishlist_after_table_action');
Пример #2
0
	<tbody>
    <?php 
if (!empty($aUsersBridallist)) {
    $i = 1;
    foreach ($aUsersBridallist as $iProductId => $aBridallistItemData) {
        if ($aBridallistItemData['type'] == 'variable' && !empty($aBridallistItemData['variations'])) {
            foreach ($aBridallistItemData['variations'] as $iVariableProductId => $bIsVariableProductBought) {
                $oProduct = new WC_Product_Variation($iVariableProductId, $iProductId);
                if ($oProduct->exists()) {
                    include UniWishlist()->plugin_path() . '/includes/views/bridalitem-variation-table-row-my.php';
                }
            }
        } else {
            $oProduct = new WC_Product($iProductId);
            if ($oProduct->exists()) {
                include UniWishlist()->plugin_path() . '/includes/views/bridalitem-table-row-my.php';
            }
        }
        $i++;
    }
} else {
    ?>
        <tr><td colspan="4"><?php 
    _e('The bridal list is empty.', 'uni-wishlist');
    ?>
</td></tr>
    <?php 
}
?>
    </tbody>
</table>
function uni_wishlist_if_bridal_item_not_bought_check($iOrderId)
{
    $oOrder = new WC_Order($iOrderId);
    $aItems = $oOrder->get_items();
    foreach ($aItems as $iItemId => $aItemData) {
        if (isset($aItemData['product_from_bridal_list']) && !empty($aItemData['product_from_bridal_list']) && !empty($aItemData['variation_id'])) {
            UniWishlist()->change_item_bought_status($aItemData['product_from_bridal_list'], $aItemData['product_id'], false, $aItemData['variation_id']);
        } else {
            if (isset($aItemData['product_from_bridal_list']) && !empty($aItemData['product_from_bridal_list']) && empty($aItemData['variation_id'])) {
                UniWishlist()->change_item_bought_status($aItemData['product_from_bridal_list'], $aItemData['product_id'], false);
            }
        }
    }
}
Пример #4
0
 function uni_bridallist_delete_from_list()
 {
     $aResult = $this->_r();
     $iProductId = isset($_POST['pid']) && !empty($_POST['pid']) ? (int) $_POST['pid'] : '';
     $iVariationId = isset($_POST['vid']) && !empty($_POST['vid']) ? (int) $_POST['vid'] : null;
     $bIsInBridallist = false;
     if (isset($iProductId) && !empty($iProductId)) {
         UniWishlist()->bridallist_delete($iProductId, $iVariationId);
         $bIsInBridallist = UniWishlist()->is_in_bridallist($iProductId, $iVariationId);
         if (!$bIsInBridallist) {
             $aResult['status'] = 'success';
             $aResult['message'] = __('Successfully deleted from your Bridal List!', 'uni-wishlist');
         } else {
             $aResult['message'] = __('Error: unknown reason', 'uni-wishlist');
         }
     } else {
         $aResult['message'] = __('Error: the product ID is not defined!', 'uni-wishlist');
     }
     wp_send_json($aResult);
 }
Пример #5
0
 /**
  * bridallist_shortcode()
  */
 public function bridallist_shortcode($atts, $content = null)
 {
     $aAttr = shortcode_atts(array(), $atts);
     if (get_option('uni_bridallist_enable')) {
         global $wp_query;
         $user_id = !empty($wp_query->query_vars['list-id']) ? absint($wp_query->query_vars['list-id']) : 0;
         $iCurrentUserId = get_current_user_id();
         if ((is_user_logged_in() || !is_user_logged_in()) && is_page() && !empty($user_id) && $iCurrentUserId != $user_id) {
             ob_start();
             include UniWishlist()->plugin_path() . '/includes/views/bridallist.php';
             return ob_get_clean();
         } else {
             if (is_user_logged_in() && is_page() && (!empty($user_id) || empty($user_id))) {
                 ob_start();
                 include UniWishlist()->plugin_path() . '/includes/views/bridallist-current.php';
                 return ob_get_clean();
             } else {
                 if (!is_user_logged_in() && is_page() && empty($user_id)) {
                     ob_start();
                     include UniWishlist()->plugin_path() . '/includes/views/bridallist-nonreg.php';
                     return ob_get_clean();
                 }
             }
         }
     }
 }