Osclass Support Forums

Osclass plugin support => Osclass Pay Plugin => Topic started by: Tango on August 09, 2022, 12:10:47 AM

Title: How to check if shipping is enabled for an item?
Post by: Tango on August 09, 2022, 12:10:47 AM
Hello,

I would like to show an icon on the listing page, when that listing is for sale and has shipping enabled.

So what is the function that returns if an item has shipping enabled or not?

I tried something like:
Code: [Select]
<?php if(function_exists('osp_product_to_cart_link') && osp_param('enable_shipping') == ) { ?>
...
But it shows the icon on all listings, not just for those that have shipping enabled.

Any ideas?
Thanks!
Title: Re: How to check if shipping is enabled for an item?
Post by: MB Themes on August 09, 2022, 10:13:59 AM
@Tango
You must get osp item data record and check if shipping is set to yes.
Title: Re: How to check if shipping is enabled for an item?
Post by: Tango on August 10, 2022, 07:39:49 PM
Yeah, I tried the following but with no luck:
Code: [Select]
$item['fk_i_item_id'] = isset($item['fk_i_item_id']) ? $item['fk_i_item_id'] : 0;
$item_data = ModelOSP::newInstance()->getItemData($item['fk_i_item_id']);

if(isset($item_data['i_shipping']) && $item_data['i_shipping'] == 1) {
...

I don't know what I'm missing...
Title: Re: How to check if shipping is enabled for an item?
Post by: MB Themes on August 16, 2022, 11:24:13 AM
@Tango
Looks good, make sure you are getting item id properly
Title: Re: How to check if shipping is enabled for an item?
Post by: Fabio Massaro on October 14, 2022, 08:40:45 AM
Yeah, I tried the following but with no luck:
Code: [Select]
$item['fk_i_item_id'] = isset($item['fk_i_item_id']) ? $item['fk_i_item_id'] : 0;
$item_data = ModelOSP::newInstance()->getItemData($item['fk_i_item_id']);

if(isset($item_data['i_shipping']) && $item_data['i_shipping'] == 1) {
...

I don't know what I'm missing...


Hi @tango could you help me I wanted to put an icon on items with shipments too
Title: Re: How to check if shipping is enabled for an item?
Post by: Tango on October 14, 2022, 09:15:53 AM
Code: [Select]
            <?php
              
if(function_exists('osp_install')) {
                
$item_data ModelOSP::newInstance()->getItemData(osc_item_id());

                if(isset(
$item_data['i_shipping']) && $item_data['i_shipping'] == 1) { ?>

                  // Your icon code here
                <?php ?>
            <?php ?>
You can apply this wherever you want.
Good luck!