1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675
<?php
/* --------------------------------------------------------------
QuickEditProductListItem.inc.php 2017-03-09
Gambio GmbH
http://www.gambio.de
Copyright (c) 2017 Gambio GmbH
Released under the GNU General Public License (Version 2)
[http://www.gnu.org/licenses/gpl-2.0.html]
--------------------------------------------------------------
*/
/**
* Class QuickEditProductListItem
*
* @category System
* @package Extensions
* @subpackage QuickEdit
*/
class QuickEditProductListItem
{
/**
* @var int
*/
protected $id;
/**
* @var string
*/
protected $model;
/**
* @var string
*/
protected $name;
/**
* @var string
*/
protected $manufacturer;
/**
* @var float
*/
protected $quantity;
/**
* @var int
*/
protected $shippingTimeId;
/**
* @var string
*/
protected $shippingStatusName;
/**
* @var float
*/
protected $weight;
/**
* @var float
*/
protected $shippingCosts;
/**
* @var int
*/
protected $taxClassId;
/**
* @var float
*/
protected $tax;
/**
* @var float
*/
protected $price;
/**
* @var float
*/
protected $discount;
/**
* @var int
*/
protected $specialPriceId;
/**
* @var float
*/
protected $specialPrice;
/**
* @var string
*/
protected $specialPriceExpiresDate;
/**
* @var float
*/
protected $specialPriceQuantity;
/**
* @var bool
*/
protected $specialPriceStatus;
/**
* @var string
*/
protected $category;
/**
* @var bool
*/
protected $status;
/**
* QuickEditProductListItem constructor.
*
* @param array $value Contains product data.
*/
public function __construct($value)
{
if(PRICE_IS_BRUTTO === 'true')
{
$this->setTax(new DecimalType((double)$value['tax_rate']));
}
$this->setId(new IdType((int)$value['products_id']));
$this->setModel(new StringType((string)$value['products_model']));
$this->setName(new StringType((string)$value['products_name']));
$this->setManufacturer(new StringType((string)$value['products_manufacturer']));
$this->setQuantity(new DecimalType((double)$value['products_quantity']));
$this->setShippingTimeId(new IntType((int)$value['products_shippingtime']));
$this->setShippingStatusName(new StringType((string)$value['shipping_status_name']));
$this->setWeight(new DecimalType((double)$value['products_weight']));
$this->setShippingCosts(new DecimalType((double)$value['nc_ultra_shipping_costs']));
$this->setTaxClassId(new IntType((int)$value['products_tax_class_id']));
$this->setPrice(new DecimalType((double)$value['products_price']));
$this->setDiscount(new DecimalType((double)$value['products_discount_allowed']));
$this->setSpecialPriceId(new IdType((int)$value['specials_id']));
$this->setSpecialPrice(new DecimalType((double)$value['specials_new_products_price']));
$this->setSpecialPriceExpiresDate($value['expires_date']);
$this->setSpecialPriceQuantity(new DecimalType((double)$value['specials_quantity']));
$this->setSpecialPriceStatus(new BoolType((bool)$value['status']));
$this->setCategory(new StringType((string)$value['products_categories']));
$this->setStatus(new BoolType((bool)$value['products_status']));
}
/**
* Returns the Id of the product.
*
* @return int Returns the Id of the product.
*/
public function getId()
{
return $this->id;
}
/**
* Sets the id of the product.
*
* @param IdType $id Product id.
*
* @return QuickEditProductListItem QuickEdit product collection.
*/
public function setId(IdType $id)
{
$this->id = $id->asInt();
return $this;
}
/**
* Returns the model of the product.
*
* @return int Returns the model of the product.
*/
public function getModel()
{
return $this->model;
}
/**
* Sets the model of the product.
*
* @param StringType $model Product model.
*
* @return QuickEditProductListItem QuickEdit product collection.
*/
public function setModel(StringType $model)
{
$this->model = $model->asString();
return $this;
}
/**
* Returns the name of the product.
*
* @return int Returns the name of the product.
*/
public function getName()
{
return $this->name;
}
/**
* Sets the name of the product.
*
* @param StringType $name Product name.
*
* @return QuickEditProductListItem QuickEdit product collection.
*/
public function setName(StringType $name)
{
$this->name = $name->asString();
return $this;
}
/**
* Returns the manufacturer of the product.
*
* @return int Returns the manufacturer of the product.
*/
public function getManufacturer()
{
return $this->manufacturer;
}
/**
* Sets the manufacturer of the product.
*
* @param StringType $manufacturer Product manufacturer.
*
* @return QuickEditProductListItem QuickEdit product collection.
*/
public function setManufacturer(StringType $manufacturer)
{
$this->manufacturer = $manufacturer->asString();
return $this;
}
/**
* Returns the quantity of the product.
*
* @return int Returns the quantity of the product.
*/
public function getQuantity()
{
return $this->quantity;
}
/**
* Sets the quantity of the product.
*
* @param DecimalType $quantity Product quantity.
*
* @return QuickEditProductListItem QuickEdit product collection.
*/
public function setQuantity(DecimalType $quantity)
{
$this->quantity = $quantity->asDecimal();
return $this;
}
/**
* Returns the shipping time id of the product.
*
* @return int Returns the shipping time id of the product.
*/
public function getShippingTimeId()
{
return $this->shippingTimeId;
}
/**
* Sets the shipping time id of the product.
*
* @param IntType $shippingTimeId Product shipping time id.
*
* @return QuickEditProductListItem QuickEdit product collection.
*/
public function setShippingTimeId(IntType $shippingTimeId)
{
$this->shippingTimeId = $shippingTimeId->asInt();
return $this;
}
/**
* Returns the shipping status name of the product.
*
* @return int Returns the shipping status name of the product.
*/
public function getShippingStatusName()
{
return $this->shippingStatusName;
}
/**
* Sets the shipping status name of the product.
*
* @param StringType $shippingStatusName Product shipping status name.
*
* @return QuickEditProductListItem QuickEdit product collection.
*/
public function setShippingStatusName(StringType $shippingStatusName)
{
$this->shippingStatusName = $shippingStatusName->asString();
return $this;
}
/**
* Returns the weight of the product.
*
* @return int Returns the weight of the product.
*/
public function getWeight()
{
return sprintf('%01.3f', $this->weight);
}
/**
* Sets the weight of the product.
*
* @param DecimalType $weight Product weight.
*
* @return QuickEditProductListItem QuickEdit product collection.
*/
public function setWeight(DecimalType $weight)
{
$this->weight = $weight->asDecimal();
return $this;
}
/**
* Returns the shipping costs of the product.
*
* @return int Returns the shipping costs of the product.
*/
public function getShippingCosts()
{
return sprintf('%01.2f', $this->shippingCosts);
}
/**
* Sets the shipping costs of the product.
*
* @param DecimalType $shippingCosts Product shipping costs.
*
* @return QuickEditProductListItem QuickEdit product collection.
*/
public function setShippingCosts(DecimalType $shippingCosts)
{
$this->shippingCosts = $shippingCosts->asDecimal();
return $this;
}
/**
* Returns the tax class id of the product.
*
* @return int Returns the tax class id of the product.
*/
public function getTaxClassId()
{
return $this->taxClassId;
}
/**
* Sets the tax class id of the product.
*
* @param IntType $taxClassId Product tax class id.
*
* @return QuickEditProductListItem QuickEdit product collection.
*/
public function setTaxClassId(IntType $taxClassId)
{
$this->taxClassId = $taxClassId->asInt();
return $this;
}
/**
* Returns the tax of the product.
*
* @return int Returns the tax of the product.
*/
public function getTax()
{
return $this->tax;
}
/**
* Sets the tax of the product.
*
* @param DecimalType $tax Product tax.
*
* @return QuickEditProductListItem QuickEdit product collection.
*/
public function setTax(DecimalType $tax)
{
$this->tax = $tax->asDecimal();
return $this;
}
/**
* Returns the price of the product.
*
* @return int Returns the price of the product.
*/
public function getPrice()
{
return sprintf('%01.2f', round($this->price * (1 + $this->tax / 100), 2));
}
/**
* Sets the price of the product.
*
* @param DecimalType $price Product price.
*
* @return QuickEditProductListItem QuickEdit product collection.
*/
public function setPrice(DecimalType $price)
{
$this->price = $price->asDecimal();
return $this;
}
/**
* Returns the discount of the product.
*
* @return int Returns the discount of the product.
*/
public function getDiscount()
{
return sprintf('%01.2f', round($this->discount, 2));
}
/**
* Sets the discount of the product.
*
* @param DecimalType $discount Product discount.
*
* @return QuickEditProductListItem QuickEdit product collection.
*/
public function setDiscount(DecimalType $discount)
{
$this->discount = $discount->asDecimal();
return $this;
}
/**
* Returns the special price id of the product.
*
* @return int Returns the special price id of the product.
*/
public function getSpecialPriceId()
{
return $this->specialPriceId;
}
/**
* Sets the special price id of the product.
*
* @param IdType $specialPriceId Product special price id.
*
* @return QuickEditProductListItem QuickEdit product collection.
*/
public function setSpecialPriceId(IdType $specialPriceId)
{
$this->specialPriceId = $specialPriceId->asInt();
return $this;
}
/**
* Returns the special price of the product.
*
* @return int Returns the special price of the product.
*/
public function getSpecialPrice()
{
return sprintf('%01.2f', round($this->specialPrice * (1 + $this->tax / 100), 2));
}
/**
* Sets the special price of the product.
*
* @param DecimalType $specialPrice Product special price.
*
* @return QuickEditProductListItem QuickEdit product collection.
*/
public function setSpecialPrice(DecimalType $specialPrice)
{
$this->specialPrice = $specialPrice->asDecimal();
return $this;
}
/**
* Returns the special price expires date of the product.
*
* @return int Returns the special price expires date of the product.
*/
public function getSpecialPriceExpiresDate()
{
return $this->specialPriceExpiresDate;
}
/**
* Sets the special price expires date of the product.
*
* @param DateTime $specialPriceExpiresDate Product special price expires date.
*
* @return QuickEditProductListItem QuickEdit product collection.
*/
public function setSpecialPriceExpiresDate($specialPriceExpiresDate)
{
$this->specialPriceExpiresDate = date('d.m.Y', strtotime($specialPriceExpiresDate));
return $this;
}
/**
* Returns the special price quantity of the product.
*
* @return int Returns the special price quantity of the product.
*/
public function getSpecialPriceQuantity()
{
return $this->specialPriceQuantity;
}
/**
* Sets the special price quantity of the product.
*
* @param DecimalType $specialPriceQuanity Product special price quantity.
*
* @return QuickEditProductListItem QuickEdit product collection.
*/
public function setSpecialPriceQuantity(DecimalType $specialPriceQuanity)
{
$this->specialPriceQuantity = $specialPriceQuanity->asDecimal();
return $this;
}
/**
* Returns the special price status of the product.
*
* @return int Returns the special price status of the product.
*/
public function getSpecialPriceStatus()
{
return $this->specialPriceStatus;
}
/**
* Sets the special price status of the product.
*
* @param BoolType $specialPriceStatus Product special price status.
*
* @return QuickEditProductListItem QuickEdit product collection.
*/
public function setSpecialPriceStatus(BoolType $specialPriceStatus)
{
$this->specialPriceStatus = $specialPriceStatus->asBool();
return $this;
}
/**
* Returns the category of the product.
*
* @return int Returns the category of the product.
*/
public function getCategory()
{
return $this->category;
}
/**
* Sets the category of the product.
*
* @param StringType $category Product category.
*
* @return QuickEditProductListItem QuickEdit product collection.
*/
public function setCategory(StringType $category)
{
$this->category = $category->asString();
return $this;
}
/**
* Returns the status of the product.
*
* @return int Returns the status of the product.
*/
public function getStatus()
{
return $this->status;
}
/**
* Sets the status of the product.
*
* @param BoolType $status Product status.
*
* @return QuickEditProductListItem QuickEdit product collection.
*/
public function setStatus(BoolType $status)
{
$this->status = $status->asBool();
return $this;
}
}