Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v3.2'
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/Helpers/StoresAvailable/Amazon.php

Took 10 minutes
  • Loading branch information
Cybrarist committed Nov 15, 2024
2 parents 8991b3f + 0bfdd42 commit 0ae953c
Show file tree
Hide file tree
Showing 36 changed files with 2,547 additions and 723 deletions.
56 changes: 56 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
APP_NAME="Discount Bandit"
APP_ENV=local
APP_KEY=
APP_DEBUG=true

APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US

APP_MAINTENANCE_DRIVER=file
APP_MAINTENANCE_STORE=database

BCRYPT_ROUNDS=12

LOG_CHANNEL=daily
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

SESSION_DRIVER=file
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null

BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database

CACHE_STORE=database
CACHE_PREFIX=

MEMCACHED_HOST=127.0.0.1

REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

VITE_APP_NAME="${APP_NAME}"

OCTANE_SERVER=frankenphp
OCTANE_HTTPS=false

APP_URL=http://localhost:8000
DB_CONNECTION=sqlite
APP_TIMEZONE=UTC
RSS_FEED=1
NOTIFY_ON_ANY_PRICE_CHANGE=0
TOP_NAVIGATION=0
DISABLE_TOP_BAR=
BREADCRUMBS=1
SPA=1
DISABLE_AUTH=1
THEME_COLOR=Stone

12 changes: 12 additions & 0 deletions app/Helpers/GeneralHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace App\Helpers;

use Illuminate\Support\Str;

class GeneralHelper
{

Expand All @@ -11,4 +13,14 @@ public static function get_numbers_only_with_dot($string): array|string|null
}


public static function get_value_from_meta_tag(array $meta_items, string $key , string $attribute): string
{
foreach ($meta_items as $meta)
foreach ($meta->attributes() as $value)
if ($value == $key)
return $meta->attributes()[$attribute]->__toString();

return "";
}

}
99 changes: 99 additions & 0 deletions app/Helpers/StoresAvailable/Ajio.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?php

namespace App\Helpers\StoresAvailable;

use Error;
use Exception;
use Illuminate\Support\Str;

class Ajio extends StoreTemplate
{
const string MAIN_URL="https://www.store/p/product_id" ;

private $meta_items;
private $product_schema;

public function __construct(int $product_store_id)
{
parent::__construct($product_store_id);
}

//define crawler
public function crawler(): void
{
parent::crawl_url();
}

public function prepare_sections_to_crawl(): void
{
try {
$this->product_schema=$this->get_product_schema(script_type: 'application/ld+json');
}catch (Error | Exception $exception) {
$this->log_error("Crawling Amazon", $exception->getMessage());
}

}
/**
* Get the data from the store
*/
public function get_name(): void
{
try {
$this->name = $this->product_schema['name'];
return;
}
catch (Error | Exception $exception){
$this->log_error("Product Name First Method", $exception->getMessage());
}
}

public function get_image(): void
{
try {
$this->image = $this->product_schema["image"];
}
catch ( Error | Exception $exception) {
$this->log_error("Product Image First Method", $exception->getMessage());
}
}

public function get_price(): void
{
try {
$this->price= (float) $this->product_schema['offers']['price'];
return ;
}
catch ( Error | Exception $exception ) {
$this->log_error("Price First Method",$exception->getMessage());
}
}

public function get_used_price(): void {}

public function get_stock(): void {}

public function get_no_of_rates(): void {}

public function get_rate(): void{}

public function get_seller(): void { $this->seller="Ajio";}

public function get_shipping_price(): void {}

public function get_condition() {}

//toDO
public static function get_variations($url) : array { return []; }


public static function prepare_url( $domain, $product, $store = null): string
{
return Str::replace(
["store", "product_id"],
[$domain , $product],
self::MAIN_URL);
}

//todo didn't encounter it yet
function is_system_detected_as_robot(): bool { return false;}
}
Loading

0 comments on commit 0ae953c

Please sign in to comment.