I had a thought about OCMods and how it'd be nice to run from the command line a script that you tell it the "code" or "name" of the OCMod and it retrieves the XML.
Before I tackle this does anyone know if this is already out there?
Mike
Before I tackle this does anyone know if this is already out there?
Mike
cue4cheap not cheap quality
You can use PHPMyAdmin for this, just see the 'oc_modification' DB table. The two relevant columns are 'name' and 'xml'.
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
Have you seen this?
https://www.opencart.com/index.php?rout ... n_id=22318
https://www.opencart.com/index.php?rout ... n_id=22318
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Yes I have and use a version like it.by mona wrote: ↑Sun Mar 16, 2025 1:37 amHave you seen this?
https://www.opencart.com/index.php?rout ... n_id=22318
But I was looking for a slight different flavor so I I could use it to get the current version from the commandline.
Mike
P.S. being able to modify the xml is one reason I wanted to download the copy with changes once the kinks were worked out.
Last edited by Cue4cheap on Sun Mar 16, 2025 4:58 am, edited 1 time in total.
cue4cheap not cheap quality
Ok here is my attempt with a BIG disclaimer: I am NOT responsible for anything this does to your system! It works for me and yes I know it could be consider non-secure!
Mike
Code: Select all
#!/bin/bash
CURRENT_DIR=$(pwd)
# Prompt user for the db info
read -p "Enter the user: " user
read -p "Enter the password: " password
read -p "Enter the database name: " db
# Database credentials
DB_HOST="localhost"
DB_USER=$user
DB_PASS=$password
DB_NAME=$db
# Output directory for XML file
OUTPUT_DIR="$CURRENT_DIR/ocmodxml_downloads"
mkdir -p "$OUTPUT_DIR"
# Prompt user for the code
read -p "Enter the modification code to download its XML: " CODE
# Check if code is provided
if [ -z "$CODE" ]; then
echo "Error: No code provided. Exiting."
exit 1
fi
# Query to get xml for the specific code
QUERY="SELECT xml FROM modification WHERE code = '$CODE';"
# Execute query and save the result
XML_CONTENT=$(mysql -h "$DB_HOST" -u "$DB_USER" -p"$DB_PASS" "$DB_NAME" -N -e "$QUERY")
# Check if anything was returned
if [ -z "$XML_CONTENT" ]; then
echo "No XML found for code: $CODE"
exit 1
else
# Save XML to a file named after the code
echo -e "$XML_CONTENT" > "$OUTPUT_DIR/${CODE}.xml"
echo "XML downloaded to $OUTPUT_DIR/${CODE}.xml"
fi
echo "Done!"
cue4cheap not cheap quality
Who is online
Users browsing this forum: No registered users and 10 guests