| @@ 425-442 (lines=18) @@ | ||
| 422 | * @return integer The tax class ID |
|
| 423 | * @throws \Exception Is thrown, if the tax class with the requested name is not available |
|
| 424 | */ |
|
| 425 | public function getTaxClassIdByTaxClassName($taxClassName) |
|
| 426 | { |
|
| 427 | ||
| 428 | // query whether or not, the requested tax class is available |
|
| 429 | if (isset($this->taxClasses[$taxClassName])) { |
|
| 430 | return (integer) $this->taxClasses[$taxClassName][MemberNames::CLASS_ID]; |
|
| 431 | } |
|
| 432 | ||
| 433 | // throw an exception, if not |
|
| 434 | throw new \Exception( |
|
| 435 | sprintf( |
|
| 436 | 'Found invalid tax class name %s in file %s on line %d', |
|
| 437 | $taxClassName, |
|
| 438 | $this->getFilename(), |
|
| 439 | $this->getLineNumber() |
|
| 440 | ) |
|
| 441 | ); |
|
| 442 | } |
|
| 443 | ||
| 444 | /** |
|
| 445 | * Return's the store website for the passed code. |
|
| @@ 452-469 (lines=18) @@ | ||
| 449 | * @return integer The store website ID |
|
| 450 | * @throws \Exception Is thrown, if the store website with the requested code is not available |
|
| 451 | */ |
|
| 452 | public function getStoreWebsiteIdByCode($code) |
|
| 453 | { |
|
| 454 | ||
| 455 | // query whether or not, the requested store website is available |
|
| 456 | if (isset($this->storeWebsites[$code])) { |
|
| 457 | return (integer) $this->storeWebsites[$code][MemberNames::WEBSITE_ID]; |
|
| 458 | } |
|
| 459 | ||
| 460 | // throw an exception, if not |
|
| 461 | throw new \Exception( |
|
| 462 | sprintf( |
|
| 463 | 'Found invalid website code %s in file %s on line %d', |
|
| 464 | $code, |
|
| 465 | $this->getFilename(), |
|
| 466 | $this->getLineNumber() |
|
| 467 | ) |
|
| 468 | ); |
|
| 469 | } |
|
| 470 | ||
| 471 | /** |
|
| 472 | * Return's the attribute set with the passed attribute set name. |
|
| @@ 479-496 (lines=18) @@ | ||
| 476 | * @return array The attribute set data |
|
| 477 | * @throws \Exception Is thrown, if the attribute set with the passed name is not available |
|
| 478 | */ |
|
| 479 | public function getAttributeSetByAttributeSetName($attributeSetName) |
|
| 480 | { |
|
| 481 | ||
| 482 | // query whether or not, the requested attribute set is available |
|
| 483 | if (isset($this->attributeSets[$attributeSetName])) { |
|
| 484 | return $this->attributeSets[$attributeSetName]; |
|
| 485 | } |
|
| 486 | ||
| 487 | // throw an exception, if not |
|
| 488 | throw new \Exception( |
|
| 489 | sprintf( |
|
| 490 | 'Found invalid attribute set name %s in file %s on line %d', |
|
| 491 | $attributeSetName, |
|
| 492 | $this->getFilename(), |
|
| 493 | $this->getLineNumber() |
|
| 494 | ) |
|
| 495 | ); |
|
| 496 | } |
|
| 497 | ||
| 498 | /** |
|
| 499 | * Return's the category with the passed path. |
|
| @@ 506-523 (lines=18) @@ | ||
| 503 | * @return array The category |
|
| 504 | * @throws \Exception Is thrown, if the requested category is not available |
|
| 505 | */ |
|
| 506 | public function getCategoryByPath($path) |
|
| 507 | { |
|
| 508 | ||
| 509 | // query whether or not the category with the passed path exists |
|
| 510 | if (isset($this->categories[$path])) { |
|
| 511 | return $this->categories[$path]; |
|
| 512 | } |
|
| 513 | ||
| 514 | // throw an exception, if not |
|
| 515 | throw new \Exception( |
|
| 516 | sprintf( |
|
| 517 | 'Can\'t find category with path %s in file %s on line %d', |
|
| 518 | $path, |
|
| 519 | $this->getFilename(), |
|
| 520 | $this->getLineNumber() |
|
| 521 | ) |
|
| 522 | ); |
|
| 523 | } |
|
| 524 | ||
| 525 | /** |
|
| 526 | * Return's the category with the passed ID. |
|
| @@ 193-210 (lines=18) @@ | ||
| 190 | * @return integer The requested visibility key |
|
| 191 | * @throws \Exception Is thrown, if the requested visibility is not available |
|
| 192 | */ |
|
| 193 | public function getVisibilityIdByValue($visibility) |
|
| 194 | { |
|
| 195 | ||
| 196 | // query whether or not, the requested visibility is available |
|
| 197 | if (isset($this->availableVisibilities[$visibility])) { |
|
| 198 | return $this->availableVisibilities[$visibility]; |
|
| 199 | } |
|
| 200 | ||
| 201 | // throw an exception, if not |
|
| 202 | throw new \Exception( |
|
| 203 | sprintf( |
|
| 204 | 'Found invalid visibility %s in file %s on line %d', |
|
| 205 | $visibility, |
|
| 206 | $this->getFilename(), |
|
| 207 | $this->getLineNumber() |
|
| 208 | ) |
|
| 209 | ); |
|
| 210 | } |
|
| 211 | ||
| 212 | /** |
|
| 213 | * Add the passed category ID to the product's category list. |
|