| @@ 418-435 (lines=18) @@ | ||
| 415 | * @return integer The tax class ID |
|
| 416 | * @throws \Exception Is thrown, if the tax class with the requested name is not available |
|
| 417 | */ |
|
| 418 | public function getTaxClassIdByTaxClassName($taxClassName) |
|
| 419 | { |
|
| 420 | ||
| 421 | // query whether or not, the requested tax class is available |
|
| 422 | if (isset($this->taxClasses[$taxClassName])) { |
|
| 423 | return (integer) $this->taxClasses[$taxClassName][MemberNames::CLASS_ID]; |
|
| 424 | } |
|
| 425 | ||
| 426 | // throw an exception, if not |
|
| 427 | throw new \Exception( |
|
| 428 | sprintf( |
|
| 429 | 'Found invalid tax class name %s in file %s on line %d', |
|
| 430 | $taxClassName, |
|
| 431 | $this->getFilename(), |
|
| 432 | $this->getLineNumber() |
|
| 433 | ) |
|
| 434 | ); |
|
| 435 | } |
|
| 436 | ||
| 437 | /** |
|
| 438 | * Return's the store website for the passed code. |
|
| @@ 445-462 (lines=18) @@ | ||
| 442 | * @return integer The store website ID |
|
| 443 | * @throws \Exception Is thrown, if the store website with the requested code is not available |
|
| 444 | */ |
|
| 445 | public function getStoreWebsiteIdByCode($code) |
|
| 446 | { |
|
| 447 | ||
| 448 | // query whether or not, the requested store website is available |
|
| 449 | if (isset($this->storeWebsites[$code])) { |
|
| 450 | return (integer) $this->storeWebsites[$code][MemberNames::WEBSITE_ID]; |
|
| 451 | } |
|
| 452 | ||
| 453 | // throw an exception, if not |
|
| 454 | throw new \Exception( |
|
| 455 | sprintf( |
|
| 456 | 'Found invalid website code %s in file %s on line %d', |
|
| 457 | $code, |
|
| 458 | $this->getFilename(), |
|
| 459 | $this->getLineNumber() |
|
| 460 | ) |
|
| 461 | ); |
|
| 462 | } |
|
| 463 | ||
| 464 | /** |
|
| 465 | * Return's the category with the passed path. |
|
| @@ 472-489 (lines=18) @@ | ||
| 469 | * @return array The category |
|
| 470 | * @throws \Exception Is thrown, if the requested category is not available |
|
| 471 | */ |
|
| 472 | public function getCategoryByPath($path) |
|
| 473 | { |
|
| 474 | ||
| 475 | // query whether or not the category with the passed path exists |
|
| 476 | if (isset($this->categories[$path])) { |
|
| 477 | return $this->categories[$path]; |
|
| 478 | } |
|
| 479 | ||
| 480 | // throw an exception, if not |
|
| 481 | throw new \Exception( |
|
| 482 | sprintf( |
|
| 483 | 'Can\'t find category with path %s in file %s on line %d', |
|
| 484 | $path, |
|
| 485 | $this->getFilename(), |
|
| 486 | $this->getLineNumber() |
|
| 487 | ) |
|
| 488 | ); |
|
| 489 | } |
|
| 490 | ||
| 491 | /** |
|
| 492 | * Return's the category with the passed ID. |
|
| @@ 168-185 (lines=18) @@ | ||
| 165 | * @return integer The requested visibility key |
|
| 166 | * @throws \Exception Is thrown, if the requested visibility is not available |
|
| 167 | */ |
|
| 168 | public function getVisibilityIdByValue($visibility) |
|
| 169 | { |
|
| 170 | ||
| 171 | // query whether or not, the requested visibility is available |
|
| 172 | if (isset($this->availableVisibilities[$visibility])) { |
|
| 173 | return $this->availableVisibilities[$visibility]; |
|
| 174 | } |
|
| 175 | ||
| 176 | // throw an exception, if not |
|
| 177 | throw new \Exception( |
|
| 178 | sprintf( |
|
| 179 | 'Found invalid visibility %s in file %s on line %d', |
|
| 180 | $visibility, |
|
| 181 | $this->getFilename(), |
|
| 182 | $this->getLineNumber() |
|
| 183 | ) |
|
| 184 | ); |
|
| 185 | } |
|
| 186 | ||
| 187 | /** |
|
| 188 | * Add the passed category ID to the product's category list. |
|