Zanox::getStats()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 17
rs 9.7
cc 1
nc 1
nop 3
1
<?php
2
3
namespace Padosoft\AffiliateNetwork\Networks;
4
5
use Padosoft\AffiliateNetwork\DealsResultset;
6
use Padosoft\AffiliateNetwork\Product;
7
use Padosoft\AffiliateNetwork\ProductsResultset;
8
use Padosoft\AffiliateNetwork\Transaction;
9
use Padosoft\AffiliateNetwork\Merchant;
10
use Padosoft\AffiliateNetwork\Stat;
11
use Padosoft\AffiliateNetwork\Deal;
12
use Padosoft\AffiliateNetwork\AbstractNetwork;
13
use Padosoft\AffiliateNetwork\NetworkInterface;
14
use Padosoft\AffiliateNetwork\ZanoxEx;
15
16
// require "../vendor/fubralimited/php-oara/Oara/Network/Publisher/Zanox/Zapi/ApiClient.php";
17
18
/**
19
 * Class Zanox
20
 * @package Padosoft\AffiliateNetwork\Networks
21
 */
22
class Zanox extends AbstractNetwork implements NetworkInterface
23
{
24
    /**
25
     * @var object
26
     */
27
    private $_network   = null;
28
    protected $_apiClient = null;
29
    private $_username  = '';
30
    private $_password  = '';
31
    private $_logged    = false;
32
    protected $_tracking_parameter    = 'zpar0';
33
34
35
    /**
36
     * @method __construct
37
     */
38 View Code Duplication
    public function __construct(string $username, string $password,string $idSite='')
0 ignored issues
show
Unused Code introduced by
The parameter $idSite is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
39
    {
40
        $this->_network = new ZanoxEx;
41
        $this->_username = $username;
42
        $this->_password = $password;
43
        $this->login( $this->_username, $this->_password );
44
45
    }
46
47
    public function login(string $username, string $password,string $idSite=''): bool
0 ignored issues
show
Unused Code introduced by
The parameter $idSite is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
48
    {
49
        $this->_logged = false;
50
        if (isNullOrEmpty( $username ) || isNullOrEmpty( $password )) {
51
52
            return false;
53
        }
54
        $this->_username = $username;
55
        $this->_password = $password;
56
        $credentials = array();
57
        $credentials["connectid"] = $this->_username;
58
        $credentials["secretkey"] = $this->_password;
59
        $this->_network->login( $credentials );
60
        $this->_apiClient = $this->_network->getApiClient();
61
        if ($this->_network->checkConnection()) {
62
            $this->_logged = true;
63
64
        }
65
66
        return $this->_logged;
67
    }
68
69
    /**
70
     * @return bool
71
     */
72
    public function checkLogin(): bool
73
    {
74
        return $this->_logged;
75
    }
76
77
    /**
78
     * @return array of Merchants
79
     */
80 View Code Duplication
    public function getMerchants(): array
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
81
    {
82
        if (!$this->checkLogin()) {
83
            return array();
84
        }
85
        $arrResult = array();
86
        $merchantList = $this->_network->getMerchantList();
87
        foreach ($merchantList as $merchant) {
88
            $Merchant = Merchant::createInstance();
89
            $Merchant->merchant_ID = $merchant['cid'];
90
            $Merchant->name = $merchant['name'];
91
            $arrResult[] = $Merchant;
92
        }
93
94
        return $arrResult;
95
    }
96
97
    /**
98
     * @param int|null $merchantID
99
     * @param int $page
100
     * @param int $items_per_page
101
     *
102
     * @return DealsResultset
103
     */
104
    public function getDeals($merchantID=NULL,int $page = 0, int $items_per_page = 0 ): DealsResultset
105
    {
106
        $result = DealsResultset::createInstance();
107
        if (!$this->checkLogin()) {
108
            return $result;
109
        }
110
        /*
111
        if (!isIntegerPositive($items_per_page) || $items_per_page <= 0 || $items_per_page > 999) {
112
            $items_per_page = 999;
113
        }
114
        */
115
        $adSpaces=$this->_apiClient->getAdspaces(0,100);
116
        if (!is_object($adSpaces)){
117
            $adSpaces=json_encode($adSpaces);
118
        }
119
        if ($adSpaces->items<1){
120
            return $result;
121
        }
122
123
        $adSpaceId=$adSpaces->adspaceItems->adspaceItem[0]->id;
124
        if (!isIntegerPositive($merchantID)){
125
            $merchantID=NULL;
126
        }
127
128
        $Response = $this->_apiClient->searchIncentives($merchantID,$adSpaceId,null,null, $page, $items_per_page);
129
        
130
        if (!is_object($Response)){
131
            $Response=json_decode($Response);
132
        }
133
        $result->page=$Response->page;
134
        $result->items=$Response->items;
135
        $result->total=$Response->total;
136
        // ($Response->total>0)?$result->num_pages=(int)ceil($Response->total/$items_per_page):$result->num_pages=0;
137
        // Check if items exists - 2018-02-27 <PN>
138
        if (!property_exists($Response, 'incentiveItems')) {
139
            return $result;
140
        }
141
        if (!property_exists($Response->incentiveItems, 'incentiveItem')) {
142
            return $result;
143
        }
144
        $arrAdmediumItems = $Response->incentiveItems->incentiveItem;
145
146
        foreach ($arrAdmediumItems as $admediumItems) {
147
            $Deal = Deal::createInstance();
148
            $Deal->deal_ID = (int)$admediumItems->id;
149
            $Deal->start_date = $Deal->convertDate($admediumItems->startDate);
0 ignored issues
show
Documentation Bug introduced by
It seems like $Deal->convertDate($admediumItems->startDate) can also be of type false. However, the property $start_date is declared as type object<DateTime>. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
150
            isset($admediumItems->endDate) ? $Deal->end_date = $Deal->convertDate($admediumItems->endDate): $Deal->end_date = '2099-12-31';
0 ignored issues
show
Documentation Bug introduced by
It seems like $Deal->convertDate($admediumItems->endDate) can also be of type false. However, the property $end_date is declared as type object<DateTime>. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
Documentation Bug introduced by
It seems like '2099-12-31' of type string is incompatible with the declared type object<DateTime> of property $end_date.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
151
            $Deal->name = $admediumItems->name;
152
            isset($admediumItems->couponCode) ? $Deal->code = $admediumItems->couponCode : $Deal->code = '';
153
            $Deal->description = $admediumItems->info4customer;
154
            $Deal->information = $admediumItems->info4publisher.' '.$admediumItems->restrictions;
155
            $Deal->is_percentage = 0;
0 ignored issues
show
Documentation Bug introduced by
The property $is_percentage was declared of type boolean, but 0 is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
156
            $Deal->discount_amount = 0;
0 ignored issues
show
Documentation Bug introduced by
The property $discount_amount was declared of type string, but 0 is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
157
            $Deal->currency_initial = '';
158
            if (isset($admediumItems->percentage) && isIntegerPositive($admediumItems->percentage)){
159
                $Deal->is_percentage = 1;
0 ignored issues
show
Documentation Bug introduced by
The property $is_percentage was declared of type boolean, but 1 is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
160
                $Deal->discount_amount = $admediumItems->percentage;
161
            }elseif (isset($admediumItems->total)){
162
                $Deal->discount_amount = $admediumItems->total;
163
                $Deal->currency_initial = $admediumItems->currency;
164
            }
165
            switch ($admediumItems->incentiveType) {
166
                case 'coupons':
167
                    $Deal->deal_type = \Oara\Utilities::OFFER_TYPE_VOUCHER;
168
                    break;
169
                case 'bargains':
170
                    $Deal->deal_type = \Oara\Utilities::OFFER_TYPE_DISCOUNT;
171
                    break;
172
                case 'noShippingCosts':
173
                    $Deal->deal_type = \Oara\Utilities::OFFER_TYPE_FREE_SHIPPING;
174
                    break;
175
                case 'freeProducts':
176
                    $Deal->deal_type = \Oara\Utilities::OFFER_TYPE_FREE_ARTICLE;
177
                    break;
178
                case 'lotteries':
179
                    $Deal->deal_type = \Oara\Utilities::OFFER_TYPE_LOTTERY;
180
                    break;
181
                default:
182
                    $Deal->deal_type = \Oara\Utilities::OFFER_TYPE_DISCOUNT;
183
                    break;
184
            }
185
            $Deal->merchant_ID = (int)$admediumItems->program->id;
186
            
187
            $Deal->merchant_name = $admediumItems->program->_;
188
            if (isset($admediumItems->admedia->admediumItem[0]->trackingLinks->trackingLink)) {
189
                $Deal->ppv = $admediumItems->admedia->admediumItem[0]->trackingLinks->trackingLink[0]->ppv;
190
                $Deal->ppc = $admediumItems->admedia->admediumItem[0]->trackingLinks->trackingLink[0]->ppc;
191
                $Deal->default_track_uri = $Deal->ppc;
192
            }
193
            else {
194
                $Deal->ppv = "*** NO LINK ***";
195
                $Deal->ppc = "*** NO LINK ***";
196
197
            }
198
            $arrResult[] = $Deal;
0 ignored issues
show
Coding Style Comprehensibility introduced by
$arrResult was never initialized. Although not strictly required by PHP, it is generally a good practice to add $arrResult = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
199
        }
200
        $result->deals[] = $arrResult;
0 ignored issues
show
Bug introduced by
The variable $arrResult does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
201
        return $result;
202
    }
203
204
205
    /**
206
     * @param \DateTime $dateFrom
207
     * @param \DateTime $dateTo
208
     * @param int $merchantID
0 ignored issues
show
Documentation introduced by
There is no parameter named $merchantID. Did you maybe mean $arrMerchantID?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
209
     *
210
     * @return array of Transaction
211
     */
212
    public function getSales(\DateTime $dateFrom, \DateTime $dateTo, array $arrMerchantID = array()): array
213
    {
214
        if (!$this->checkLogin()) {
215
            return array();
216
        }
217
        $dateFrom2=new \DateTime($dateFrom->format('Y-m-d'));
218
        if ($dateTo->format('Y-m-d')==$dateFrom2->format('Y-m-d')){
219
            $dateFrom2->sub(new \DateInterval('P1D'));
220
        }
221
222
        $arrResult = array();
223 View Code Duplication
        if (count( $arrMerchantID ) < 1) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
224
            $merchants = $this->getMerchants();
225
            foreach ($merchants as $merchant) {
226
                $arrMerchantID[$merchant->merchant_ID] = ['cid' => $merchant->merchant_ID, 'name' => $merchant->name];
227
            }
228
        }
229
        $transcationList = $this->_network->getTransactionList( $arrMerchantID, $dateFrom2, $dateTo );
230
        foreach ($transcationList as $transaction) {
231
            $Transaction = Transaction::createInstance();
232
            array_key_exists_safe( $transaction,
233
                'currency' ) ? $Transaction->currency = $transaction['currency'] : $Transaction->currency = '';
234
            array_key_exists_safe( $transaction,
235
                'status' ) ? $Transaction->status = $transaction['status'] : $Transaction->status = '';
236
            array_key_exists_safe( $transaction,
237
                'amount' ) ? $Transaction->amount = $transaction['amount'] : $Transaction->amount = '';
0 ignored issues
show
Documentation Bug introduced by
The property $amount was declared of type double, but '' is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
238
            array_key_exists_safe( $transaction,
239
                'custom_id' ) ? $Transaction->custom_ID = $transaction['custom_id'] : $Transaction->custom_ID = '';
240
            array_key_exists_safe( $transaction,
241
                'title' ) ? $Transaction->title = $transaction['title'] : $Transaction->title = '';
242
            array_key_exists_safe( $transaction,
243
                'unique_id' ) ? $Transaction->unique_ID = $transaction['unique_id'] : $Transaction->unique_ID = '';
244
            array_key_exists_safe( $transaction,
245
                'commission' ) ? $Transaction->commission = $transaction['commission'] : $Transaction->commission = '';
0 ignored issues
show
Documentation Bug introduced by
The property $commission was declared of type double, but '' is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
246
            $date = new \DateTime( $transaction['date'] );
247
            $Transaction->date = $date; // $date->format('Y-m-d H:i:s');
0 ignored issues
show
Documentation Bug introduced by
It seems like $date of type object<DateTime> is incompatible with the declared type string of property $date.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
248
            array_key_exists_safe( $transaction,
249
                'merchantId' ) ? $Transaction->merchant_ID = $transaction['merchantId'] : $Transaction->merchant_ID = '';
0 ignored issues
show
Documentation Bug introduced by
The property $merchant_ID was declared of type integer, but '' is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
250
            array_key_exists_safe( $transaction,
251
                'approved' ) ? $Transaction->approved = $transaction['approved'] : $Transaction->approved = '';
0 ignored issues
show
Documentation Bug introduced by
The property $approved was declared of type boolean, but '' is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
252
            $arrResult[] = $Transaction;
253
        }
254
255
        return $arrResult;
256
    }
257
258
    /**
259
     * @param \DateTime $dateFrom
260
     * @param \DateTime $dateTo
261
     * @param int $merchantID
262
     *
263
     * @return array of Stat
264
     */
265
    public function getStats(\DateTime $dateFrom, \DateTime $dateTo, int $merchantID = 0): array
266
    {
267
        return array();
268
        /*
269
        $this->_apiClient->setConnectId($this->_username);
270
        $this->_apiClient->setSecretKey($this->_password);
271
        $dateFromIsoEngFormat = $dateFrom->format('Y-m-d');
272
        $dateToIsoEngFormat = $dateTo->format('Y-m-d');
273
        $response = $this->_apiClient->getReportBasic($dateFromIsoEngFormat, $dateToIsoEngFormat);
274
        $arrResponse = json_decode($response, true);
275
        $reportItems = $arrResponse['reportItems'];
276
        $Stat = Stat::createInstance();
277
        $Stat->reportItems = $reportItems;
278
279
        return array($Stat);
280
        */
281
    }
282
283
    /**
284
     * @param  array $params  this array can contains these keys
285
     *                        string      query          search string
286
     *                        string      searchType     search type (optional) (contextual or phrase)
287
     *                        string      region         limit search to region (optional)
288
     *                        int         categoryId     limit search to categorys (optional)
289
     *                        array       programId      limit search to program list of programs (optional)
290
     *                        boolean     hasImages      products with images (optional)
291
     *                        float       minPrice       minimum price (optional)
292
     *                        float       maxPrice       maximum price (optional)
293
     *                        int         adspaceId      adspace id (optional)
294
     *                        int         page           page of result set (optional)
295
     *                        int         items          items per page (optional)
296
     *
297
     * @return ProductsResultset
298
     */
299
    public function getProducts(array $params = []): ProductsResultset
300
    {
301
        $_params = array_merge([
302
            'query' => null,
303
            'searchType' => null,
304
            'query' => null,
305
            'searchType' => null,
306
            'region' => null,
307
            'categoryId' => null,
308
            'programId' => null,
309
            'hasImages' => null,
310
            'minPrice' => null,
311
            'maxPrice' => null,
312
            'adspaceId' => null,
313
            'page' => 0,
314
            'items' => 10
315
        ], $params);
316
        $products =  $this->_network->getProducts($_params);
317
        $set = ProductsResultset::createInstance();
318
        if (!property_exists($products, 'productItems') || !property_exists($products->productItems, 'productItem'))
319
        {
320
            return ProductsResultset::createInstance();
321
        }
322
323
        $set->page = $products->page;
324
        $set->items = $products->items;
325
        $set->total = $products->total;
326
327
        foreach ($products->productItems->productItem as $productItem) {
328
            $Product = Product::createInstance();
329
            if (property_exists($productItem, 'name')) {
330
                $Product->name = $productItem->name;//'Danava',
331
            }
332
            if (property_exists($productItem, 'modified')) {
333
                $Product->modified = $productItem->modified; //'2016-11-24T11:52:03Z',
334
            }
335
            if (property_exists($productItem, 'program')) {
336
                $Product->merchant_ID = $productItem->program->id; //'Twelve Thirteen DE'
337
                $Product->merchant_name = $productItem->program->_; //17434,
338
            }
339
            if (property_exists($productItem, 'price'))
340
                $Product->price = $productItem->price; //129.0
341
            if (property_exists($productItem, 'currency'))
342
                $Product->currency = $productItem->currency; //'EUR'
343
            if (property_exists($productItem, 'trackingLinks') && property_exists($productItem->trackingLinks, 'trackingLink')) {
344
                $Product->ppv = $productItem->trackingLinks->trackingLink[0]->ppv;
345
                $Product->ppc = $productItem->trackingLinks->trackingLink[0]->ppc;
346
                $Product->adspaceId = $productItem->trackingLinks->trackingLink[0]->adspaceId;
0 ignored issues
show
Bug introduced by
The property adspaceId does not seem to exist in Padosoft\AffiliateNetwork\Product.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
347
            }
348
            if (property_exists($productItem, 'description'))
349
                $Product->description = $productItem->description; //'Rosegold trifft auf puristisches Schwarz ? aufwendige und traditionelle Makramee Technik trifft auf Eleganz. Das neue Danava Buddha Armband besteht aus schwarzem Onyx, dieser Edelstein wird sehr gerne als Schmuckstein verwendet und viel lieber getragen. Der feingearbeitete rosegoldene Buddha verleiht diesem Armband einen fernöstlichen Stil. Es lässt sich wunderbar zu allen Anlässen Tragen und zu vielen Outfits kombinieren, da es Eleganz ausstrahlt. Das Symbol des Buddhas ist besonders in dieser Saison sehr gefragt.',
350
            if (property_exists($productItem, 'manufacturer'))
351
                $Product->manufacturer = $productItem->manufacturer; //'Twelve Thirteen Jewelry'
352
            if (property_exists($productItem, 'ean'))
353
                $Product->ean = $productItem->ean; //'0796716271505'
354
            if (property_exists($productItem, 'deliveryTime'))
355
                $Product->deliveryTime = $productItem->deliveryTime; //'1-3 Tage'
356
            if (property_exists($productItem, 'priceOld'))
357
                $Product->priceOld = $productItem->priceOld; //0.0
358
            if (property_exists($productItem, 'shippingCosts'))
359
                $Product->shippingCosts = $productItem->shippingCosts; //'0.0'
360
            if (property_exists($productItem, 'shipping'))
361
                $Product->shipping = $productItem->shipping; // '0.0'
362
            if (property_exists($productItem, 'merchantCategory'))
363
                $Product->merchantCategory = $productItem->merchantCategory; //'Damen / Damen Armbänder / Buddha Armbänder'
364
            if (property_exists($productItem, 'merchantProductId'))
365
                $Product->merchantProductId = $productItem->merchantProductId; //'BR018.M'
366
            if (property_exists($productItem, 'id'))
367
                $Product->id = $productItem->id; //'1ed7c3b4ab79cdbbf127cb78ec2aaff4'
368
            if (property_exists($productItem, 'image') && property_exists($productItem->image, 'large')) {
369
                $Product->image = $productItem->image->large;
370
            }
371
            $set->products[] = $Product;
372
        }
373
374
        return $set;
375
    }
376
377
    public function getTrackingParameter(){
378
        return $this->_tracking_parameter;
379
    }
380
}
381